AuthSession - "No default redirect URL could be found"

Hi guys, long time lurker first time poster here:)

I have successfully put together Expo and Auth0. Worked like a charm until used iPhone simulator instead of real phone.

I use Authorization Code Flow with PKCE and this code:

  const useProxy = Platform.select({ web: false, default: true });
  const redirectUri = AuthSession.makeRedirectUri({ useProxy });

throws a nasty exception

No default redirect URL could be found. If you're using the bare workflow, you'll need to provide this yourself.
* http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:224850:23 in getRedirectUrl
* http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:221193:44 in makeRedirectUri

So how come? It works on a real phone but does not on a simulator? No eject has been done, still managed expo workflow

Any ideas or thoughts on this?
I ve read AuthSession docs form the letter A to the letter Z. Did I miss something?
Would be more than happy to hear you out
many thanks in advance!

Same problem here. I have a project in SDK 36 and works fine. Since I updated it to 39 stop working. Every time I call a AuthSession’s function with useProxy: true it throws that exception
EDIT: Testing the app on iOS works fine. Android throws exception.

Hello all,

I’m now experiencing the same issue after running expo upgrade from sdk 38 → 39. This is in the managed workflow. Stack trace starts with the following error:

No default redirect URL could be found. If you're using the bare workflow, you'll need to provide this yourself.

Stack trace:
  http://192.168.50.42:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:192278:23 in getRedirectUrl

This is happening in both getRedirectUrl and makeRedirectUri, both with and without useProxy set.

This is using expo-auth-session 2.0.1.

Hi. I am experiencing this issue and I needed to solve it at any cost. I got expo-auth-session to work by manually editing this file (in node_modules): expo/SessionUrlProvider.ts at a1142e8b0d2e8c50528a031ef87449a2f5dba717 · expo/expo · GitHub

I will try to understand why this condition is true even if my app is not in the bare workflow and maybe open a pull request.

I just removed the condition and I made this function to return new ManagedSessionUrlProvider() inconditionally.

Update 1: after debugging, I found that Constants.executionEnvironment returns undefined.

Update 2: according to the docs, the constant executionEnvironment does not even exists.

Update 3: reading the source of Constants in expo/packages/expo-constants/src/Constants.ts, executionEnvironment is a native constant. I will investigate why it is undefined for Managed Workflow

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.