[expo-web-browser] openAuthSessionAsync restarts the app when getting redirected.

SDK Version: 40

Workflow: bare

Platforms(Android/iOS/web/all): Android

Problem:

Hello, I have finished developing the first alpha for my app, everything works as intended in development mode (using Android Studio AVD), but at least in my phone it doesn’t.

I’m using openAuthSessionAsync to authenticate users using an external oauth provider, with the following code:


try {
            let result = await openAuthSessionAsync(authURL,makeUrl());
            if (result.url) {
              const { url } = result;
              let token = url.split("#access_token=").pop().split("&")[0];
              console.log(token)
              saveToken(token);
            }else{
              console.log(result.type)
            }
          } catch (error) {
            console.log("error opening browser: " + error);
          }

The thing is that upon a successful authentication, the app seems to get restarted, as the splash screen is shown…

Of course the normal course would be that the expo browser gets closed and returns a url just like the docs says.

As I said this is working properly with the Android emulator, but at least in my device it isn’t.

I’ve also tried to install the same chrome version as the emulator, just in case it had something to do with the default browser.

I’ve also tried another alternatives, like using openBrowserAsync and adding an event listener to it with expo-linking, and again, it works in development but not in production.

In case it helps the project is here:

And an the apk here:

Update: this seems to be an issue with my device since it’s working for everyone else, for future reference if you experience this issue it could be related to not having GCM and an official android ROM in your device, which is my case.

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