Invalid Redirect_uri For instagram login using react native

后端 未结 1 1862
遥遥无期
遥遥无期 2021-01-12 14:00

I am using react-native-instagram-login for React Native.

Here is my code



        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-12 14:34

    From Instagram Basic Display API:

    Valid OAuth Redirect URIs

    Enter your website’s URL. Normally this would be a dedicated URI that can capture redirect query string parameters, but for this tutorial your website’s URL will be fine.

    For example: https://socialsizzle.heroku.com/auth/

    After you enter a URL, save your changes and check the URL again; we may have appended a trailing forward slash depending your URL structure. Copy the complete URL somewhere since you will need it in later steps to get authorization codes and access tokens.

    At this example code, we see the redirectUrl='https://www.google.com', which means that you can set whatever you want. It is useful for collecting login data statistics and to have a backend endpoint for logging.

     this.setState({ token })}
      onLoginFailure={data => this.setState({ failure: data })}
    />
    

    Also have a look at this issue "no response when completed" which it says that redirectUrl has to start with a www because of a bug in react-native-webview. Also at this issue, you'll see that the user example code has a Firebase function endpoint URL redirectUrl="https://us-central1-xxx.cloudfunctions.net/url_get&response_type=token" so it uses Firebase to log/feedback login requests.

    Finally, in Facebook Developer Console, you just enter the Valid OAuth Redirect URIs:

    which means that you enter which URLs you accept for the API to redirect; it's more like a security mechanism but you have to enter your redirect URL there, or else the API won't work.

    0 讨论(0)
提交回复
热议问题