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

Sign In With Apple not working on Android (OAuth) #1037

Open
mattr12 opened this issue Sep 16, 2024 · 2 comments
Open

Sign In With Apple not working on Android (OAuth) #1037

mattr12 opened this issue Sep 16, 2024 · 2 comments
Labels
auth This issue or pull request is related to authentication bug Something isn't working

Comments

@mattr12
Copy link

mattr12 commented Sep 16, 2024

Describe the bug
When signing in with Apple on an Android device, a browser opens up with my project's url briefly (.supabase.co), then redirects to an Apple sign in form. Upon successful sign in, it just redirects within the browser to a "This site cannot be reached" page with a url on localhost:3000. Tried both inside an Android emulator with internet and Play Store service as well as an actual Android physical device--same issue.

Yet, the flow works fine on both my iOS simulator and physical device.

To Reproduce
Steps to reproduce the behavior:
I followed the docs for Flutter, under Android:

https://supabase.com/docs/guides/auth/social-login/auth-apple?queryGroups=environment&environment=client&queryGroups=platform&platform=flutter

  1. Made sure to call signInWithOAuth since native sign in is reserved for iOS/macOS.
  2. Added an App ID, Service ID, and a private key on my Apple developer account. Added my domain to the service ID, plus <project-id>.supabase.co to "Domains and Subdomains" when configuring service ID, and https://<project-id>.supabase.co/auth/v1/callback for "Return URLs".
  3. Used the Supabase Apple client secret generator (found in the docs link above) to generate client secret.
  4. Enabled Apple sign in on Supabase auth dashboard, pasted in service ID, client secret, and bundle id (for iOS app under "Authorized Client IDs").

Expected behavior
Expected to be able to login after successfully signing into my Apple account. To either be redirected to the Android app or for onAuthStateChange to at least emit a new signed in user. Neither occurred.

Version (please complete the following information):
├── supabase_flutter 2.5.3
│ ├── supabase 2.1.3
│ │ ├── functions_client 2.2.0
│ │ ├── gotrue 2.7.0
│ │ ├── postgrest 2.1.2
│ │ ├── realtime_client 2.0.4
│ │ ├── storage_client 2.0.1

@mattr12 mattr12 added the bug Something isn't working label Sep 16, 2024
@dshukertjr dshukertjr added the auth This issue or pull request is related to authentication label Sep 18, 2024
@dshukertjr
Copy link
Member

@mattr12 Could you try to open the sign-in screen on an external browser like this?

supabase.auth.signInWithOAuth(
  OAuthProvider.apple,
  redirectTo: redirectTo,
  authScreenLaunchMode: LaunchMode.externalApplication,
);

@mattr12
Copy link
Author

mattr12 commented Sep 19, 2024

@mattr12 Could you try to open the sign-in screen on an external browser like this?

supabase.auth.signInWithOAuth(
  OAuthProvider.apple,
  redirectTo: redirectTo,
  authScreenLaunchMode: LaunchMode.externalApplication,
);

@dshukertjr Updated authScreenLaunchMode.

App side: Still does not login, no new events emitted from onAuthStateChange or redirect in the app.

Browser side: Loads the login screen in a separate browser, but it still just hangs after signing in and says it cannot load the page, but now I can see an error response in the URL:

http://localhost:3000/?error=server_error&error_code=500&error_description=Unable+to+exchange+external+code%3A+c3740de9aeffb.0.mtux.9YaAgImA#error=server_error&error_code=500&error_description=Unable+to+exchange+external+code%253A+c3740de9aeffb.0.mtux.9YaAgImA

500: Unable to exchange external code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth This issue or pull request is related to authentication bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants