Linking redirect Issue


#1

Hi,

I have some issues with deep linking. I am trying to implement Swedish bankID auth system, my workflow is like this:

  1. Link to bankId from my app
  2. Authenticate user
  3. Redirect back to my app and collect auth token

I have an issue with step n3. Whatever I do, I am not redirected back. I tried examples from the docs, but I am probably missing something or my redirect url is wrong. This is the code.

const redirectUrl = Linking.makeUrl();
const url = `bankid:///?autostarttoken=d19906882975d8de44030de1581a415e&redirect=${redirectUrl}`;

Linking.openURL(url);

This opens the bankId app, but doesn’t redirects back.

I also tried something like this:

  const redirectUrl = Linking.makeUrl();
  const url = `bankid:///?autostarttoken=d19906882975d8de44030de1581a415e&redirect=${redirectUrl)}`;

  handleUrl = url => {
    const { path, queryParams } = Linking.parse(url);
        Linking.openURL(`bankid:///?autostarttoken=d19906882975d8de44030de1581a415e&redirect=${queryParams.redirect}`);

  };

handleUrl(url)

Again, it doesn’t redirects back.
When I test it like this:

  Linking.canOpenURL(url)
        .then(supported => {
          if (supported) {
              Linking.openURL(url);
          } else {
              console.log('This URL scheme is not installed');
          }
        })
        .catch(err => console.log(err));

It will log ‘This URL scheme is not installed’

I am testing in expo dev environment on IOS.
What am I doing wrong?


closed #2

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