【ReactNative開発】Expo Google Sign Inをローカルでテストしようとすると”expo-google-sign-in is not supported in the Expo Client”エラーが発生する

こんにちは。会社でもらった夏休みを使って、引き続きReact Nativeと苦闘しております。

問題

React Native + ExpoでGoogle Sign Inを使うためのライブラリ”expo-google-sign-in”を試してみているのですが、ローカルデバッグしようとしたところ、以下のワーニングが発生しました。

[Unhandled promise rejection: Invariant Violation: expo-google-sign-in is not supported in the Expo Client because a custom URL scheme is required at build time. Please refer to the docs for usage outside of Expo www.npmjs.com/package/expo-google-sign-in]

原因と解決方法

Stack Overflowで悲報を発見。

https://stackoverflow.com/questions/68152443/expo-google-sign-in-is-not-supported-in-the-expo-client-because-a-custom-url-sch

You can’t test GoogleSignIn with the client as it requires baking in your reverse_client_id into the info.plist which is only possible with standalone apps. You can use TestFlight to create a standalone .ipa to test on iOS which doesn’t require you to go through the review process. As for Android, you can create an apk and install it onto your device.

なんと、ローカルでは使えない・・?ここでも・・・

https://github.com/expo/expo/issues/4854

どうやら、expo-google-sign-inはExpo Clientでは使えない、これは事実らしい。

うーん、そうすると、SOで書かれているように、都度TestFlightなどでStandaloneアプリでテストしないといけないのかな・・・

もう少し調べてみると、以下のドキュメントを見つけた。

https://github.com/expo/expo/issues/7307

どうやら、expo-app-auth / expo-google-app-authを代替策となりうるっぽい?改めて公式Docを見てみると、確かにExpo Go (ExpoのClientアプリ)で使いたいなら、上記を検討して、と書いています。

https://docs.expo.dev/versions/latest/sdk/google-sign-in/

なるほど、ちょっと調べてみよう。というわけで、expo-app-auth / expo-google-app-authを使った認証については、また別の記事でまとめておこうと思います。

・・・(数分後)

って、expo-app-auth / expo-google-app-auth、deprecated (廃止)されとるやん笑

というわけで、このページのリンクの先に、ヒントがありそうです。読んできまっす!

https://docs.expo.dev/versions/latest/sdk/app-auth/

React Native、つまづいてばっかりで辛いよ笑

続く

この記事を気に入っていただけたらシェアをお願いします!

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

ABOUT US
Yuu113
初めまして。ゆうたろうと申します。 兵庫県出身、東京でシステムエンジニアをしております。現在は主にデータ分析、機械学習を活用してビジネスモデリングに取り組んでいます。 日々学んだことや経験したことを整理していきたいと思い、ブログを始めました。旅行、カメラ、IT技術、江戸文化が大好きですので、これらについても記事にしていきたいと思っています。