LoginSignup
1
0

More than 5 years have passed since last update.

【React Native】Googleログインで使用してるGoogleアプリ切り替え時にする管理画面の操作とソース変更箇所 for Android

Last updated at Posted at 2018-03-09

やりたいこと

AndroidのGoogleログイ認証を使用しています。
Googleの管理画面で別のアプリ(スマホアプリではなく、Google管理画面上のアプリ)に
向き先を変更したいです。

前提

すでにGoogleログインの実装が完了している前提のため、
Googleログインを導入する方法は記載していません。

管理画面

https://console.cloud.google.com
 →CLIENT_IDなどを取得
https://developers.google.com/mobile/add?platform=android
 →「google-services.json」取得

変更箇所

管理画面

パッケージ名:バンドルID
SHE-1:
*SHE-1の取得方法

keytool -exportcert -keystore {.keystoreのパス} -list -v

google-services.json変更

パス:android/app/google-services.json

GoogleSignin.configure

jsソースで、Googleログインを使用する画面で下記の関数を呼ぶ必要がある。
GoogleSignin.configure

https://console.cloud.google.com
で確認できる値を入れる。
WEB_CLINENT_ID:webのクライアント ID
IOS_CLINENT_ID:iOSのクライアント ID

>例

    const config = {
      webClientId: {WEB_CLINENT_ID:web},
      offlineAccess: false,
    };
    if (Platform.OS === 'ios') {
      config.iosClientId = {IOS_CLINENT_ID};
    }
    await GoogleSignin.configure({ config });
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0