auth: Apple Sign On: [AuthApiError: Bad ID token]

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Starting today receiving "error": [AuthApiError: Bad ID token] when trying to sign in with Apple.

Wasn’t happening before today. identityToken is returned by Apple.

To Reproduce

Using Apple Button with the following code:

 const credential = await AppleAuthentication.signInAsync({
              requestedScopes: [
                AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
                AppleAuthentication.AppleAuthenticationScope.EMAIL,
              ],
            })

            console.log({ credential, id: credential.identityToken })

            if (credential.identityToken) {
              const {
                error,
                data: { user, session },
              } = await supabase.auth.signInWithIdToken({
                provider: "apple",
                token: credential.identityToken,
              })

              console.log({ error: error, user, session })

              if (!error) {
                setAuth(user, session)
                // User is signed in.
              }
            } else {
              throw new Error("No identityToken.")
            }
            // signed in
          } catch (e) {
...

Expected behavior

Should sign in

Screenshots

N/A

System information

  • OS: Mac OS
  • React Native Expo App
  • Version of supabase-js: 2.39.1
  • Version of Node.js: N/A

Additional context

N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 11
  • Comments: 51 (9 by maintainers)

Most upvoted comments

Confirmed same problem on Flutter.

Hey team,

Thanks for patiently waiting. You should now be able to upgrade to a patched version under Settings > Infrastructure > Upgrade Postgres Version to 15.1.1.16 - do note that this will involve some downtime

We’ll be rolling out the patch across the board next week.

Thanks!

Hey everyone, we’ve made the fix in this PR and will roll it out to all affected projects on supabase soon. We haven’t made any changes to apple oauth recently so it seems like apple changed the type returned in their API to include booleans too (https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple)

is_private_email A string or Boolean value that indicates whether the email that the user shares is the proxy address. The value can either be a string (“true” or “false”) or a Boolean (true or false).

Hey everyone, we’ve just rolled out the fix but if you’re still seeing the same issue, please reach out to us via https://supabase.help and mention this issue.

This was fixed in version 2.139.2 #1395.

#1395

You can check the Gotrue version of your project here: https://supabase.com/dashboard/project/_/settings/infrastructure

I’m not sure how to upgrade my GoTrue version? I updated PostgreSQL version but GoTrue is still 2.132.3 😕

Hello, i‘ll figure it out, if i can implement sth, im kinda new to software development. Have a nice EveningSent from my iPhoneOn 06.02.2024, at 6:44 PM, Andrey Ruzencevs @.***> wrote: Thank you @kangmingtay. would it be possible to set up some monitoring for Oauth services on your side?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

hey, I am setting up Native Apple sign in wih supabase in my react native project, my error is

 {
  "error": {
    "__isAuthError": true,
    "name": "AuthApiError",
    "status": 400
  },
  "user": null
}

and the same code as described in the issue, I am

@J0 Thank you for confirming here, this fixed Apple auth in one of our projects as well!

Is there a standard way that these kinds of regressions and subsequent fixes are communicated with Supabase users? This one caused a fair amount of grief for our team and I imagine we are not the only ones. If not (I wasn’t able to find anything), an email or toast within the dashboard would be very helpful and would have saved us hours of time in this case.

Another user in discord with this error.
Not sure why this is closed.

I am “only” experiencing this issue when the user chooses not to share the e-mail whilst signing in with apple (resulting in a apple-relay e-mail)… hope this helps debugging

@kangmingtay We are seeing this issue as well, and had a store submission rejected because of it.

I originally opened https://github.com/supabase/supabase/issues/21109

How can we get this fix applied to our hosted Supabase application?

Edit: I have created a support ticket as well

@andrisole92 @Aayush9029 found your tickets and i’ve just rolled out the fix to them

@kangmingtay i have contacted 26 hours back and haven’t heard anything back yet.

@andrisole92 @Aayush9029 can yall please reach out to https://supabase.help/ so we can investigate? the internal error message that you should be observing from your project’s auth logs should along the lines of json: invalid use of ,string struct tag, trying to unmarshal unquoted value into *bool. If you’re seeing a different error, it may be something else but we’ll need more information to investigate further.