Skip to content

Instantly share code, notes, and snippets.

@jackrobertscott
Created December 10, 2019 13:30
Show Gist options
  • Save jackrobertscott/c9a996458308730be580733dc3e043b3 to your computer and use it in GitHub Desktop.
Save jackrobertscott/c9a996458308730be580733dc3e043b3 to your computer and use it in GitHub Desktop.
import * as queryString from 'query-string';
const stringifiedParams = queryString.stringify({
client_id: process.env.CLIENT_ID_GOES_HERE,
redirect_uri: 'https://www.example.com/authenticate/google',
scope: [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
].join(' '), // space seperated string
response_type: 'code',
access_type: 'offline',
prompt: 'consent',
});
const googleLoginUrl = `https://accounts.google.com/o/oauth2/v2/auth?${stringifiedParams}`;
@malkabraca
Copy link

mal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment