Implementing facebook and google authentication in my React Native application has been a challenge. The entire process is handled on the server-side with ExpressJS using passport. Upon successful authentication, I aim to redirect with the following URL pattern:
AppName://login?data=somejson
To enable this functionality, I have registered a custom scheme in expo's app.json as outlined in the documentation available at . My JSON configuration appears as follows:
{
"expo": {
"name": "My App",
"slug": "my-app",
"sdkVersion": "21.0.0",
"privacy": "public",
"scheme": "AppName"
}
}
The guide suggests using a specific link to open the app in Expo development mode which should resemble this:
exp://wg-qka.community.app.exp.direct:80/+
Despite modifying my server code to redirect with the specified pattern above, the desired outcome is still not achieved. Although I can successfully login via the browser, the redirection does not proceed as expected. Even after adding an event listener for this scenario:
exp://wg-qka.community.app.exp.direct:80/login?data=somejson
In my App.js file for React Native, I have implemented the necessary event listener but unfortunately, it does not trigger as anticipated:
Linking.addEventListener('url', this.someFunction);
Linking.getInitialURL().then((url) => {
// perform certain operations
});