Warning: This sample shows how to use GAM with Google as an external OAuth 2.0 provider. GeneXus does not support the configuration of this external system. Samples, screenshots, parameters, and/or locations may change over time.
This article explains how to authenticate your users with Google using GeneXus Access Manager (GAM).
1. Enter to the GAM's Backend and go to the Authentication Types section. Create a new OAuth 2.0 Authentication Type and define basic information in the General section: Name, Description, Images (optional), etc.
2. In the Configuration section you need to define, for the General, Authorization, Token and User Information tab, the following:
Client ID: client_id Value: <clientid>
Client Secret: client_secret Value: <clientsecret>
Redirect URL: redirect_uri Value: https://<server>/webapp
URL: https://accounts.google.com/o/oauth2/auth
Response type: response_type Value: code
Scope: scope Value: https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile
State: state
Include ClientID and RedirectURL
Additional Parameters for Smart Devices: access_type=offline
Response:
Access code TAG: code
Error description TAG: error_description
URL: https://accounts.google.com/o/oauth2/token
Header Cotent type: Content-type Value: application/x-www-form-urlencoded
Grant type: grant_type Value: authorization_code
Include All
Aditional Parameters:
Response:
Access token TAG: access_token
Token type TAG: token_type
Expires in TAG: expires_in
Refresh Token TAG: refresh_token
Error description TAG: error_description
Validate external token = True
Refresh token URL = leave it empty. Uses the same URL used to ask for a Token.
URL: https://www.googleapis.com/oauth2/v1/userinfo
Method: Get
Header Content type: Content-type Value: application/json;charset=utf-8
Do not include anything.
Email TAG: email
Verified Email Tag: verified_email
External ID TAG: id
Name TAG: email
First name TAG: given_name
Last name TAG: family_name
Gender TAG: gender Values: M=male&M=hombre&F=female&F=mujer
URL Image TAG: picture
URL Profile TAG: link
Language TAG: locale
Error description TAG: error_description
As of GeneXus 15 Upgrade 11.
GAM - OAuth 2.0 Authentication Type