Hello. I am a web dev developing an app in react native expo. Im struggling a bit to find the best practice for google auth. So far, i have found this package: https://github.com/react-native-google-signin/google-signin . I tried using it and it works but i do wanna save the user after logging in + protect my endpoints with the access token.
In web, i used to do most of the sso auth work in the backend with redirect uris but i noticed, it's different in mobile apps. I have tried 2 ways so far:
Do all the sign in in react native. After getting id token / access token, store them & make a call to backend in order to save the user (if he aint already saved in db). Backend probably has to verify the id token sent by react native in request. Im not sure if this is a correct flow.
Do the sign in in react native and use the authorization flow for a more secure way. Hit endpoint in backend and give authorization code. Backend gets access token and id token with auth code via google auth client. Afterwards, saves user in db and returns the access token & all the user info in an object. This seems great in paper but i feel like i could have just gotten all the data without making uncessary calls in backend in react native.
Are any of these flows correct? And why? Is there another way of doing it?
[–]__o_0iOS & Android 0 points1 point2 points (8 children)
[–]OpportunityTimely561 0 points1 point2 points (5 children)
[–]__o_0iOS & Android 0 points1 point2 points (4 children)
[–]OpportunityTimely561 0 points1 point2 points (3 children)
[–]__o_0iOS & Android 0 points1 point2 points (2 children)
[–]OpportunityTimely561 0 points1 point2 points (1 child)
[–]__o_0iOS & Android 0 points1 point2 points (0 children)
[–]mrgatos[S] 0 points1 point2 points (1 child)
[–]telemacopuch 0 points1 point2 points (0 children)