React native Linking not trigger addEventListener when URL change

Loading...

React native Linking not trigger addEventListener when URL change

I want to implement the authentication with callbacks urls using React native . I can't catch to handler of addEventListener when url changed:
Linking.addEventListener('url', this.handleDeepLink);

Noting happend :s
I follow the official docs of facebook but i didn't get any callback.
https://facebook.github.io/react-native/docs/linking.html

Solutions/Answers:

Answer 1:

Have you defined URL Scheme for callback Url ?

I think You are searching for this:

https://medium.com/@jtremback/oauth-2-with-react-native-c3c7c64cbb6d#.hdrovcyls

follow the steps involved to use Linking. I assume you did configurations in Xcode if you are building for on iOS or if for android check the official docs for deep linking.

PS: the custom URL Scheme you going to define in Xcode may not allow by all the social auths. for example: facebook doesn’t allow you to set “yourapp://” as redirection url where twitter, google+, dropbox let you do that.

the above process will be valid if your backend will redirect to custom URL you defined in URL Scheme.

For the best practices, use Sdks for social auths.

Most of the things I assumed writing this answer if it relates to you thats better otherwise drop a comment with specific details.

References

Loading...