Userinfo GAM Service

Official Content
This documentation is valid for:

It's a REST service to obtain the user's information.

Through the service /oauth/gam/userinfo it is possible to obtain the user's information.
Before running the service, authentication is required. To this end, you must obtain an Oauth 2.0 token through the service access_token. The service is then invoked through the GET or POST methods.

Endpoint

$ServerURL/oauth/gam/userinfo

Configuration

For this to work, a certain configuration is needed at the level of the GAM Application where the service is configured:

UserInfo__png

  • &GAMApplication.ClientAllowRemoteAuthentication = True. (Although GAM requests that a ClientCallbackURL and a ClientLocalLoginURL be indicated, they will not be used in this case.)

  • &GAMApplication.ClientAllowGetUserRoles = True. (If you want to get the user's roles.)

  • &GAMApplication.ClientAllowGetUserAdditionalData = True. (To obtain the dynamic attributes of the user.)

GET

In this case, the authentication token (&access_token) goes in the header.

&method = !"GET"
&headername = "Authorization"
&headervalue = "OAuth " + &access_token

&getstring = &urlbase + "/oauth/gam/userinfo"

&httpclient.AddHeader(&headername, &headervalue)
&httpclient.AddHeader("GeneXus-Agent","SmartDevice Application")
&httpclient.Execute(&method, &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.toString()

POST

In this case, the authentication token (&access_token) goes in the body.

&method = !"POST"

&getstring = &urlbase + "/oauth/gam/userinfo"

&httpclient.AddHeader("GeneXus-Agent", "SmartDevice Application")
&httpclient.AddVariable(!"access_token", &access_token)
&httpclient.Execute(&method, &getstring)

&httpstatus = &httpclient.StatusCode
&result = &httpclient.toString()

Response

{
    "guid":"139f4332-3f40-47b0-8fb4-ee7b3dbddc4f",
    "username":"admin",
    "email":"admin",
    "verified_email":true,
    "first_name":"Administrator",
    "last_name":"User",
    "external_id":"",
    "birthday":"2000-01-01",
    "gender":"N",
    "url_image":"https://",
    "url_profile":"",
    "phone":"+598",
    "address":".",
    "city":".",
    "state":".",
    "post_code":".",
    "language":"Eng",
    "timezone":".",
    "CustomInfo":"",
    "roles":["is_gam_administrator"]
}