βοΈLogin with Google
Last updated
Last updated
// This is an OAuth 2.0 credential example.
{
"web": {
"client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"project_id": "YOUR_PROJECT_ID",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uris": ["YOUR_REDIRECT_URI"]
}
}// This is a callback URL. You have to implement the API to handle the URL.
https://yourband.com/auth/callback?returnUrl=%2Fhome&username=your.user&authKey=xxx// This is a pseudo-code in your application.
function handleAuthCallback(request)
// Extract returnUrl, username, and authKey from query parameters
returnUrl = request.query.returnUrl
username = request.query.username
authKey = request.query.authKey
// Verify if the authKey is valid
if isValidAuthKey(authKey)
// If valid, authenticate the user
user = authenticateUser(username, authKey)
if user is not null
// Redirect to returnUrl if authentication is successful
redirect(returnUrl)
else
// Handle authentication failure
redirect("/login?error=authenticationFailed")
else
// Handle invalid authKey scenario
redirect("/login?error=invalidAuthKey")