Skip to main content

Authentication Method: oAuth 2.0

OAuth 2.0 is an authorization framework based on token authentication that allows access to the API without revealing user credentials by using access tokens.

This method uses the user's credentials (user ID and password) to validate identity and deliver an access token for API usage.

User Credentials

The user ID and password are generated and provided by Gosocket for both test and production environments.

UserName: xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx
Password: xxxxxxxxxxxxxx

To generate oAuth 2.0 type credentials, it is necessary to have a domain user @gosocket.net with an administrator profile.

  1. Log in to the portal.
  2. Enter the company settings.
  3. Select the Apikeys tab: In this tab, existing credentials are displayed, and new credentials can be created.
  4. To create a new credential, click on the button to Add Apikey and select the authentication method: oAuth_20_method

After confirming the method, a row will be inserted in the list of credentials.

oAuth_20

Token Acquisition

To obtain the access token, consume the endpoint:

Use the POST method and the following parameters:

  • Grand Type: client_credentials
  • Client_id: UserName of the credentials generated by Gosocket
  • Client_secret: Password of the credentials generated by Gosocket
  • scope: All

The obtained token is of "Bearer" type.

Example:

{
"access_token": "NAjqd5J2p61Pc6EYX8yKbz1oPnDQFYFY",
"expires_in": 7200,
"token_type": "bearer"
}

API Consumption

To consume the API, it is necessary to use the obtained token and configure the Bearer Token authentication method. The token's validity must be taken into account since a new one must be generated if it expires.