Skip to content

Instantly share code, notes, and snippets.

@ilake
Last active March 7, 2018 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilake/6107b49dc14d0389c16d46fe72c5f866 to your computer and use it in GitHub Desktop.
Save ilake/6107b49dc14d0389c16d46fe72c5f866 to your computer and use it in GitHub Desktop.
let redirectUrl = Expo.AuthSession.getRedirectUrl();
let response = await Expo.AuthSession.startAsync({
authUrl:
`https://accounts.google.com/o/oauth2/v2/auth?` +
`&client_id=${GOOGLE_WEB_APP_ID}` +
`&redirect_uri=${encodeURIComponent(redirectUrl)}` +
`&response_type=code` +
`&access_type=offline` +
`&prompt=consent` +
`&scope=${encodeURIComponent('https://www.googleapis.com/auth/plus.profile.emails.read https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/contacts')}`,
});
// response is like
// { type: "success",
// errorCode: undefined,
// url: "exp://localhost:19000/+expo-auth-session?code=4%2F…dVIg_D5axLSsDNjl9VIN_qTYcxH4ZQzEUGj_71OHxQo-9NLS8",
// params: {
// code: "4/AAAHF_zoV_I89Odu2qn5aX6ehHFZp1KKKMrTUhdVIg_D5axLSsDNjl9VIN_qTYcxH4ZQzEUGj_71OHxQo-9NLS8"
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment