Why is my universal route not working? Or what is it actually doing?

Viewed 11

I am setting a universal link with a React Native app. It is routing to my app, but I am not getting the behavior that I expect.

Here is the component piece of my AASA file.

"components": [
    {
        "#": "no_universal_links",
        "exclude": true,
        "comment": ""
    },
    {
        "/": "/oauth*",
        "comment": "Redirect URL for OAuth"
    }
]

The AASA file is hosted at a url that I own. I have installed the app on my phone, pulled the sysdiagnose file off my device and verified that my app is downloading the AASA file, so the routes should be working on my device.

In my React Native code, I have an event watcher looking at the urls that are being used to open the app. I am using the expo-linking library to log the url and params.

function handleLink(event) {
    const data = Linking.parse(event.url);
    console.log(data, data);
  }
  React.useEffect(() => {
    Linking.getInitialURL().then((res) => {
      console.log(res);
    });

    const listener = Linking.addEventListener("url", handleLink);

    return () => listener.remove();
  }, []);

When I route to <url>/oauth in safari, it gives the options to open up my app. When I use the app option the system then routes to my app. The code above then logs out the url and query params from the url that opened the app.

When I try to use the universal link for the actual OAuth redirect (not from Safari), it opens up my app, but no url is logged out from the event, so the event is not being hit at all. Also, it looks like it is opening up some kind of webpage in my app, but the fact is I really don't know what it is doing.

In short, when using my app with another service calling the url, it opens up my app, but I only see a white page and only know I am on my app by looking at the title of the app.

If anyone could give me any direction, I would be really grateful.

0 Answers
Related