Hi hapi community,
Within PlantNet project, we are planning to include Google/Apple/Facebook login into our mobile apps. Bell is setup and works in like 20 line of codes for the web app, based on redirect.
The issue appear when we want to integrate native apps login flow. In those case, we cannot use a http redirect or a webview to ask the user credentials. What we want is using native sdk for signing in (quick demo there. The usual method I've seen is to get the tokenId from Google on the client and sending it to the API for verification and standard login/signup process.
What would be your implementation recommendation for this use case?
Is there any examples that we can look into?
Many thanks
I took a quick look at the documentation for the server-side here: https://developers.google.com/identity/sign-in/android/offline-access. It seems as though the client will obtain an auth token from Google, and if it sends that token to your API then your API will be able to obtain the user's information from Google. I think you will need to create a route to accept this auth code and reach out to Google to turn it into profile information.
I don't believe that bell or any official hapi plugin will do this for you, however bell's google provider configuration should help! You will post to the token endpoint defined here, and you can use the profile mapping logic defined there too: https://github.com/hapijs/bell/blob/master/lib/providers/google.js#L12. This is accessible at require('@hapi/bell').providers.google.
For further questions about this the hapi hour slack might be a good bet: https://join.slack.com/t/hapihour/shared_invite/zt-g5ortpsk-ErlnRA2rUcPIWES21oXBOg
Thank you very much 🙏 for the guidelines.
Take care
Most helpful comment
I took a quick look at the documentation for the server-side here: https://developers.google.com/identity/sign-in/android/offline-access. It seems as though the client will obtain an auth token from Google, and if it sends that token to your API then your API will be able to obtain the user's information from Google. I think you will need to create a route to accept this auth code and reach out to Google to turn it into profile information.
I don't believe that bell or any official hapi plugin will do this for you, however bell's google provider configuration should help! You will post to the token endpoint defined here, and you can use the profile mapping logic defined there too: https://github.com/hapijs/bell/blob/master/lib/providers/google.js#L12. This is accessible at
require('@hapi/bell').providers.google.For further questions about this the hapi hour slack might be a good bet: https://join.slack.com/t/hapihour/shared_invite/zt-g5ortpsk-ErlnRA2rUcPIWES21oXBOg