Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X API OAuth Authorization fails on iPad WebView with unsupported browser error #1123

Closed
TakanoriSatou opened this issue Dec 19, 2024 · 2 comments

Comments

@TakanoriSatou
Copy link

[Bug] X API OAuth Authorization fails on iPad WebView with unsupported browser error

Description

When attempting to use X (formerly Twitter) API OAuth authorization in Unity WebView on iPad, users encounter a browser compatibility error after pressing the login button.

Environment

  • Unity WebView plugin: Latest master branch source code
  • Platform: iPad only
  • OS versions affected:
    • iPadOS 18.1.1 or later
    • iPadOS 17.7.2 or later
  • User-Agent: Default (no specific configuration)

Steps to Reproduce

  1. Open WebView in the application
  2. Initiate X API OAuth flow using "oauth/authorize" endpoint
  3. Press the login button on X's authorization page

Current Behavior

After pressing the login button, X displays an error page with the following messages:

  • "このブラウザは現在サポートされていません。" (Japanese)
  • "Please switch to a supported browser to continue using x.com. You can see a list of supported browser in our Help Center."

Expected Behavior

The OAuth authorization should complete successfully, allowing users to connect their X account.

Additional Information

  • Issue can be reproduced with the latest master branch of the plugin
  • The error page redirects to X's browser compatibility help page: https://help.x.com/ja/using-x/x-supported-browsers
  • This issue appears to be iPad-specific; no similar issues observed on other platforms
  • No custom User-Agent has been specified in WebView configuration
    IMG_0454

Questions

  1. Is there a way to modify the WebView user agent or configuration to make it compatible with X's OAuth flow?
  2. Are there any known workarounds for this issue on iPad?
  3. Are there any specific User-Agent settings recommended for X OAuth authorization?

Any assistance or insights would be greatly appreciated.

@KojiNakamaru
Copy link
Member

The issue could be solved by specifying wkContentMode to 1.

//wkContentMode: 0, // 0: recommended, 1: mobile, 2: desktop

Alternatively, specifying ua could be the only way.

//ua: "custom user agent string",

NOTE: Utilizing WebView for OAuth is generally not recommended and Google prohibits it for their platform.

@TakanoriSatou
Copy link
Author

@KojiNakamaru
Thank you for the solutions and advice.

Setting wkContentMode to 1 resolved the issue as suggested.

I understand the security concerns regarding WebView OAuth authentication and will take this into consideration.

I'm closing this issue as the problem has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants