Issues with Linking from WebBrowser in Standalone app

What is the proper url format when linking back to your app from a WebBrowser? I have set up my scheme in exp.json myappname:// but when I redirect back to my app (with Constants.linkinguri) I get an error:

“There was a problem loading the experience”.

when setting my redirect url to my published app url myappname:// the app renders another version of the app within itself.

The same code works in the published expo app.

Any ideas?

1 Like

Are you referring to the WebBrowser native module? There’s an example here which might clarify things:

If you’re still seeing the error, is there any other information on the error screen?

Thanks for the reply ben,

I’m using the WebBrowser provided by Expo, I followed the auth0 example and this is the result i’m seeing:

Example from Detached App

Once the re-direct happens I’m listening for changes like the auth0 example.
Linking.addEventListener('url', this.handleToken);

On the published version within the expo app this works flawlessly.

1 Like

Interesting. What is the value of Constants.linkingUri (while in your standalone app) and the value of scheme in exp.json?

"scheme": "projectCharlotte",

and Constants.linkingUri returns: projectCharlotte://

And for reference here’s my code block that builds that redirect url (copied from auth0 example)

let redirectUri;
if (Constants.manifest.xde) {
  redirectUri = 'exp358622080df04874ac8f685547ec093b://';
} else {
  // redirectUri = `projectCharlotte://`;

What’s interesting is if I pass in the published exp link the app opens another instance within itself. So I still get the black bar at the top that says “Back to project Charlotte” but no error.

**edit: the redirectUri in the example is from my ExpoKit version of the project. I’ve tried with both attached and detached with the same results as above.

1 Like

@awoodall can you clarify whether this is a detached app or a standalone app?

Hey @jesse, thanks for hopping into the thread.

The issue appears in both detached and standalone. Below is a video of the Standalone app (the above video was the detached app). Both are having similar issues but different error messages:

Example from Standalone App

To deploy to TestFlight I followed the Building Standalone Apps guide and used Pilot to deploy to the app store.

which sdk version are you using @awoodall? (“sdkVersion” in exp.json)

based on what I see in the error message and the code that you provided above, it looks like Constants.linkingUri is not defined. it tries to redirect to exp:///redirect, which is consistent with ${Constants.linkingUri}/redirect where Constants.linkingUri is an empty string. how are you verifying that the redirectUri is what you expect it to be?

@notbrent i’m using "sdkVersion": "16.0.0",

To check that it’s correct on the Standalone app i’m displaying it like so:

<Text style={{marginTop:20}}>{redirectUri}</Text>

which returns: projectCharlotte:///redirect

I can also see the request on our server which has the correct redirect url as well.

can you try also adding linkingUri to your screen?

<Text style={{marginTop:20}}>linkingUri: {Expo.Constants.linkingUri}</Text>

@notbrent – Here’s what Expo.Constants.linkingUri returns:

Hello @awoodall, I will try to replicate your issue and get back to you as soon as possible. In the meantime, can you tell me it works properly when running while developing in Expo? You did confirm it was working while published on Expo correct?

Hey @charlesvinette – Thanks for the help,

It does work when developing in Expo. The published version on Expo works as well. Only standalone is having the redirect issue.

Got it thanks for the details, looking into it!

Hello @awoodall, just wanted to drop by and let you know I am still working on the issue, I could reproduce and I am looking in the SDK. I will update you during the week, and feel free to PM me on the Expo Slack channel if you feel like discussing a little more!

I’ve found a bug where Constants.linkingUri is incorrect specifically when attaching to a debug ExpoKit build from Xcode. This is probably leading to this issue. I’ll work on a fix for the next release.

Awesome, Thanks @ben for the update!

This should be fixed with this change. That will be included in the SDK 18 ExpoKit release, which is tagged ios/1.17.0.

1 Like

hey guys,

I’m having similar problem on SDK19 with standalone app.

It’s odd - sometimes it works, and sometimes it doesn’t.

I’m seeing Constants.linkingUri not be my scheme, instead it’s

Please Please, can you make a standalone and display Constants.linkingUri and see if you can reproduce it not displaying the scheme?

cc: @ben @charlesvinette

1 Like

Image uploaded from iOS