supabase/auth-js

supabase.auth.signInWithIdToken() authunknownerror when used on real ios device

pariah140 opened this issue · 0 comments

Describe the bug

When using supabase auth to perform native sign in on ios with expo-apple-authentication on an eas development build signin faills with an error returned from

supabase.auth.signInWithIdToken()

This does not occur on expo go.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Follow the tutorial from supabase on how to set up ios social authentication
  2. Produce a development build using eas and run on a real ios device
  3. Login using apple id
  4. Error is returned as follows:

{ "error": { "__isAuthError": true, "name": "AuthUnknownError", "originalError": {} }, "user": null }

Expected behavior

Login successful

System information

  • OS: ios (ipad)

Additional context

Example code:

                    try {
                        const credential = await AppleAuthentication.signInAsync({
                            requestedScopes: [
                                AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
                                AppleAuthentication.AppleAuthenticationScope.EMAIL,
                            ],
                        })
                        // Sign in via Supabase Auth.
                        if (credential.identityToken) {
                            const {
                                error,
                                data: { user },
                            } = await supabase.auth.signInWithIdToken({
                                provider: 'apple',
                                token: credential.identityToken,
                            })
                            console.log(JSON.stringify({ error, user }, null, 2))
                            if (!error) {
                                // User is signed in.
                            }
                        } else {
                            throw new Error('No identityToken.')
                        }
                    } catch (e) {
                        if (e.code === 'ERR_REQUEST_CANCELED') {
                            // handle that the user canceled the sign-in flow
                        } else {
                            // handle other errors
                        }
                    }
                }}```