LoginSignup
3
2

More than 5 years have passed since last update.

WebViewでFirebase AuthのGoogle認証してエラー

Posted at

やろうとしたこと

WebViewでの動作を確認しようと、Unityを使ってアプリ内でWebページを表示し、外部ブラウザを立ち上げずにFirebase AuthのGoogleアカウント認証を通そうとした。

起こったこと

Error: disallowed_useragent

スクリーンショット 2019-01-16 16.55.22.png

原因

2016年に、GoogleはWebViewでのOAuth認証をブロックするようになっていた。

対策

Googleとしても、「ユーザーは1つの端末につき1回Googleにサインインするだけでよくなる」との理由から、外部ブラウザを立ち上げるのが推奨、とのことらしい。

Using the device browser for OAuth requests instead of an embedded web-view can improve the usability of your apps significantly: users only need to sign-in to Google once per device, improving conversion rates of sign-in and authorization flows in your app. Modern “in-app browser tab” patterns available on some operating systems, such as Chrome Custom Tabs on Android and SFSafariViewController on iOS offer further UX improvements for browser-based OAuth flows.

なので、外部ブラウザからURLスキーマとかを使うなどする。

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