Issues with Linking from WebBrowser in Standalone app


#1

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://exp.host/username/appname the app renders another version of the app within itself.

The same code works in the published expo app.

Any ideas?


#2

Are you referring to the WebBrowser native module? There’s an example here which might clarify things: https://github.com/expo/auth0-example

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


#3

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.


#4

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


#5

"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;
console.log(Constants.manifest);
if (Constants.manifest.xde) {
  redirectUri = 'exp358622080df04874ac8f685547ec093b://6g-ss9.awoodall.project-charlotte.exp.direct/+/redirect';
} else {
  redirectUri=`${Constants.linkingUri}/redirect`;
  // redirectUri = `projectCharlotte://exp.host/@awoodall/projectCharlotte/+/redirect`;
}

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.


#6

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


#7

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.


#8

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?


#9

@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.


#10

can you try also adding linkingUri to your screen?

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

#11

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


#12

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?


#13

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.


#14

Got it thanks for the details, looking into it!


#15

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!


#16

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.


#17

Awesome, Thanks @ben for the update!


#18

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


#19

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 https://exp.host...

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


#20