Add Google Sign to Expo app, and server-side session handling

Viewed 1054

Environment

  • React Native 0.62
  • Expo SDK Version: 37
  • Platforms(Android and iOS):

Context

Hi, I am building an app using Expo client and I would like to add Google Sign in. I have already created both iOS and Android client ids from Google developer platform console.

Basically, I want to do what StackOverflow, and many others do:

  • Ask the user to allow the app to access their Google profile info and email, the first time
  • Register them as a new user in my backend database using the retrieved data
  • After the first authorization, the user can directly sign in to the app with google without having to authorize again
  • My backend API will handle user sessions that are independent from Google, which keeps the user connected to the app even when they sign out of their Google account
  • If the user is already signed in to their google account, the app automatically signs them in to their account.

I have been reading Google documentation and Expo documentation for weeks now and I feel very confused because there are many solutions but they all seems very ambiguous: expo-google-sign-in, expo-google-app-auth, expo-app-auth, expo-auth-session

My questions:

  • As far as I understand expo-google-app-auth is used for OAuth 2.0 authorization to get a refreshToken and a accessToken used to make calls to various Google APIs. On the other hand expo-google-sign-in is used to make user able to log in to their Google account. Is that right?

  • If I am not wrong about expo-google-sign-in then this is what I should use for my application, right ? the problem is that it doesn't work with Expo Client, Only in standalone apps according to Expo docs. So I really don't know what to do!

  • Are there any tutorials or courses on how to make a React Native App (using Expo and Expo Client) with Google Sign in and server-side user session handling ?

0 Answers
Related