Given oauth_app resource not found - Magic.Link

714 Views Asked by At

I tries to integrate magic link social authentication to my React Native Mobile app and it always gives error Given oauth_app resource not found as in the attached file.

I use the code as described in the documentation and they're as follows,

 const MagicElement = new Magic('pk_test_***********', {
  extensions: [new OAuthExtension()],
});

 try {
      const result = await MagicElement.oauth.loginWithPopup({
        provider: 'apple' /* 'google', 'facebook', 'apple', or 'github' */,
        redirectURI: 'testapp://demo/your/oauth/callback',
      });
      console.log('result', result)
    } catch (error) {
      console.log('error', error)
    }
  }

https://docs.magic.link/client-sdk/web/social-login

enter image description here

Appreciate if anyone can help to solve this issue.

1

There are 1 best solutions below

0
On

Be careful what parameters you are passing to loginWithPopup etc. An easy step to take if you encounter this screen is to look at the network tab filtered on "document" type.

In my case [object%20Object] in the request URL was a giveway:

https://auth.magic.link/v1/oauth2/[object%20Object]/start?magic_api_key=...

After fixing the parameters the URL became something like

https://auth.magic.link/v1/oauth2/google/start?magic_api_key=...

and the error went away.