LoginSignup
1
2

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-03-09

やりたいこと

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

前提

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

管理画面

https://console.cloud.google.com
 →CLIENT_IDなどを取得
https://developers.google.com/mobile/add?platform=ios
 →「GoogleService-Info.plist」取得

変更箇所

管理画面

パッケージ名:バンドルID

xcode

infoのschemeにGoogleService-Info.plistにある、REVERSED_CLIENT_IDを利用

url-config.png

GoogleService-Info.plist変更

パス:ios/GoogleService-Info.plist

GoogleSignin.configure

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

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

>例

GoogleSignin.configure({
  iosClientId: <WEB_CLINENT_ID:web>, // only for iOS
  webClientId: <IOS_CLINENT_ID:iOS>, // client ID of type WEB for your server (needed to verify user ID and offline access)
})
.then(() => {
  // you can now call currentUserAsync()
});

1
2
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
2