この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
reactnative:expo:googleサインイン [2019/02/16 11:40] ips |
reactnative:expo:googleサインイン [2019/02/16 14:10] (現在) ips |
||
---|---|---|---|
ライン 110: | ライン 110: | ||
- | === エラー === | + | ===== エラー1 (crash)===== |
apkにしたときオプションにbehavior:webだとクラッシュする。 | apkにしたときオプションにbehavior:webだとクラッシュする。 | ||
systemだと内部ブラウザが立ち上がり、ログインしても何もかえってこない。 | systemだと内部ブラウザが立ち上がり、ログインしても何もかえってこない。 | ||
- | 下記ドキュメントをよくみてみるとandroidStandaloneAppClientIdにしないとだめ? | + | 下記ドキュメントをよくみてみるとandroidStandaloneAppClientIdに変更する必要がる。 |
[[https://docs.expo.io/versions/v31.0.0/sdk/google/|Google]] | [[https://docs.expo.io/versions/v31.0.0/sdk/google/|Google]] | ||
+ | |||
+ | |||
<code> | <code> | ||
- | androidClientId (string) -- The Android client id registered with Google for use in the Expo client app. | + | ・androidClientId (string) -- The Android client id registered with Google for use in the Expo client app. |
+ | ⇒expoのデバッグ用 | ||
- | androidStandaloneAppClientId (string) -- The Android client id registered with Google for use in a standalone app. | + | ・androidStandaloneAppClientId (string) -- The Android client id registered with Google for use in a standalone app. |
+ | ⇒apkを作るときにはこちらで設定する。 | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | try { | ||
+ | const result = await Expo.Google.logInAsync({ | ||
+ | androidStandaloneAppClientId: androidClientId, | ||
+ | scopes: ["profile", "email","https://www.googleapis.com/auth/spreadsheets"], | ||
+ | behavior: 'web' | ||
+ | }) | ||
+ | if (result.type === "success") { | ||
+ | ・・・ | ||
+ | </code> | ||
+ | |||
+ | ===== エラー2 (redirect_uri_mismatch)===== | ||
+ | エラー1の設定変更(androidStandaloneAppClientIdとbehaviorの変更)により、apkでも外部ブラウザにとぶようになるが、redirect_uriのエラーがでる場合がある。 | ||
+ | |||
+ | expoのテストではパッケージ名に「host.exp.exponent」を設定していた箇所に、実際のアプリのパッケージ名を設定する。 | ||
+ | 下記の場合は「com.nekotype.expo.meomry2」 | ||
+ | |||
+ | {{:reactnative:expo:pasted:20190216-140846.png}} | ||
+ | <code> | ||
+ | redirect_uri=com.nekotype.expo.meomry2:/oauthredirect | ||
+ | client_id=xxxxx.apps.googleusercontent.com | ||
+ | response_type=code | ||
+ | state=xxxx | ||
+ | scope=profile email https://www.googleapis.com/auth/spreadsheets | ||
+ | code_challenge=xxxx | ||
+ | code_challenge_method=xx | ||
+ | That’s all we know. | ||
</code> | </code> | ||