amazon app store in app purchase、amazon web app tester+amazon app testerアプリでテスト購入はokなのに、本番公開後の環境ではamzn_wa.IAPにnullが入ってくる…
下記画像の通りだが、コンソール画面で、ウェブアプリ機能のところのIn-App Purchasingにチェックが入っていないのが原因だった…。審査出す際に忘れてしまっていた…。
人工知能で作曲
http://www.geocities.co.jp/Playtown-Spade/4013/dlmidi/dlmidi1.html
からいただき、音ファイルを作ってみました。
http://suzukitest.box.ph/1501365924_gNFbYxbZkj3WZ0D5nrAs.mp3
でも…なんか…これじゃない的な感じが凄くする…。
※こちらの環境では、学習にものすごく時間がかかってしまい、1000回(step 1000)くらいの段階で断念したものです…。(6〜7時間でそれくらいまでしか行かなかった。もしかしたら、ウインドウをアクティブにしていなくて優先度が落とされていた、とかあるかもしれませんが…)
2万回学習させてみたら、結構変わるのだろうか…
AWS上に、ディスクイメージから作成して動かしているBitnami wordpressのLet’s Encrypt(https化)を更新
sudo ./letsencrypt-auto renew --force-renewal -w /home/bitnami/apps/wordpress/htdocs
で更新が成功し、
sudo /opt/bitnami/ctlscript.sh restart apache
再起動することで、ブラウザから証明書を見た際、更新が確認できた
※最初、-wオプションを付けずに実行したら、以下のエラーが出てしまった。
Attempting to renew cert from /etc/letsencrypt/renewal/ドメイン.conf produced an unexpected error: Failed authorization procedure. ドメイン (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://ドメイン/.well-known/acme-challenge/U3ZG_cx_F84fETF9ayB0mlEyRZJqPWTTKhUKL2_JZRc: "<!DOCTYPE html>
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/ドメイン/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: ドメイン
Type: unauthorized
Detail: Invalid response from
http://ドメイン/.well-known/acme-challenge/U3ZG_cx_F84fETF9ayB0mlEyRZJqPWTTKhUKL2_JZRc:
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
これは、
こちらが詳しいが、
「おそらく、HTTPサーバ(Apache、もしくはnginxなど)で設定したドキュメントルートと、letsenctypt-auto
コマンドで指定したドキュメントルートが食い違っているのが原因です。」がまさに自分の場合でも該当したと思われ、-wオプションで、最初に証明書を設定した時と同じ、ドキュメントルートのパス(/home/bitnami/apps/wordpress/htdocs)を入れたらokだった。
mobilehubから作った場合の、cognito user poolにおける、ユーザー管理の注意点
通常、webサービスで使いたいと思った場合、email+passwordでユーザーを管理したいと思うのだが、cognito user poolだと、基本的に、username+passwordという管理体制がデフォルトとなっている。
awsももちろん、email+passwordで管理できるようにするためのことは考えていて、aliasという属性があり、これにチェックを付けていると、例えば、usernameを求められる所に、emailを入れても通るようになる。
ただ、若干そのあたりが厄介で、例えば、mobilehubからuserpoolを自動で作った場合だと、AttributesのemailにAlias設定がついているが、Requiredのチェックは付いていない。
そしてRequiredにチェックが付いていないと、php等のローレベルapiから、adminInitiateAuthなどの関数でアクセスしようと思った際に、usernameにemailの値を入れても、user does not existエラーが返ってきてしまう。
(※チェックが入っていれば問題なく通るので、PHPなどのローレベルapiで使いたければ、自前で別途poolを作る必要があるということ…)
また、Appsという項目があるが、js、並びにPHPなどのローレベルapiからアクセスさせたい場合、App client secretが使われているとアクセス出来ない(http://docs.aws.amazon.com/ja_jp/cognito/latest/developerguide/setting-up-the-javascript-sdk.html
「JavaScript SDK はクライアントシークレットのあるアプリケーションをサポートしていないため、[Generate client secret] チェックボックスは外しておく必要があります。」参照)
のだが、デフォルトでonになってしまっている。
これは、自分も最初全く気づかなかったのだが、複数アプリを作ることが出来るので(Apps の画面の下に、「Add another app」というボタンがある)、そこで、Generate client secretを外して作ったアプリのApp client idを使ってアクセスさせれば、js、並びにPHPなどのローレベルapiからアクセス可能になった。
あくまでmobile環境から使うだけであれば全く問題無いのだが、それをpcなど別デバイスからアクセスさせたいと思った時に、上記のような設定が必要になる。
※余談だが、mobilehubから設定したのではない、user poolを使おうとした場合、cognitoのtopから行ける、「Manage Federated Identites」→作成した物を選択→「Edit Identify pool」→「Authentication providers」→「Cognito」のUser Pool IDと、App Client IDを変更する必要があった。(元々は、mobile hubから作られた、user poolの物が入っているため)
また、もちろん、アプリ側も、例えばawsが作ってくれるサンプルファイルで言うところの、AWSConfiguration.swiftにUserPoolId、Client id、secretがあるので、そこも入れ替える必要がある。
cognito、phpからadminInitiateAuthを使うとAccessDeniedException
Fatal error: Uncaught exception 'Aws\CognitoIdentityProvider\Exception\CognitoIdentityProviderException' with message 'Error executing "AdminInitiateAuth" on "https://cognito-idp.ap-northeast-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://cognito-idp.ap-northeast-1.amazonaws.com` resulted in a `400 Bad Request` response: {"__type":"AccessDeniedException","Message":"User: arn:aws:iam::xxxxxx:user/xxxxxxxxx is not authorized to pe (truncated...) AccessDeniedException (client): User: arn:aws:iam::xxxxxxxx:user/xxxxxxxx is not authorized to perform: cognito-idp:AdminInitiateAuth on resource: arn:aws:cognito-idp:ap-northeast-1:xxxxxxxx:userpool/ap-northeast-xxxxxxx - {"__type":"AccessDeniedException","Message":"User: arn:aws:iam::xxxxxxx:user/xxxxxxx is not authorized to perform: cognito-idp:AdminInitiateAuth on resource: arn:aws:cognito-idp:ap-northeast-1:xxxxxxx:userpool/ap-northeast-xxxxxxx"}' exception 'GuzzleHttp\Exception\ClientException' with message 'Cl in /Library/WebServer/Documents/bmj/aws_sdk/Aws/WrappedHttpHandler.php on line 192
というエラーが…。これは、該当するユーザーのIAMで、
AmazonCognitoDeveloperAuthenticatedIdentities
AmazonCognitoPowerUser
の2つをアタッチすればokだった。