Authentication

GAINSConnect supports two methods of authentication:

  • Basic authentication: username and password has to be defined in GAINS User Management (this can be done by an existing admin or a GAINS admin)
  • oAuth2.0: as of August 2025, we also support access via oAuth 2.0. Please contact GAINS rep if you would like to get set up with your access token

oAuth Authentication

Please note the server URL's for oAuth token generation:

These servers are used only for token generation and are the same for all clients — they are not your GAINSConnect environment.

Requesting a token

Send a POST to /realms/GAINSystems/protocol/openid-connect/token on the server above, with an application/x-www-form-urlencoded body. GAINSystems is the realm that issues tokens for the GAINSConnect API:

FieldRequiredValue
grant_typeYesclient_credentials
client_idYesThe client identifier you were issued
client_secretYesThe secret you were issued
curl -X POST https://auth.gainsapps.com/realms/GAINSystems/protocol/openid-connect/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=<your client id>" \
  -d "client_secret=<your client secret>"

The response

{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJqTl9F...",
  "expires_in": 600,
  "refresh_expires_in": 0,
  "token_type": "Bearer",
  "not-before-policy": 0,
  "scope": "email profile"
}
FieldMeaning
access_tokenThe JWT to present to GAINSConnect
expires_inSeconds the token remains valid — 600, i.e. 10 minutes
refresh_expires_in0: no refresh token is issued
token_typeAlways Bearer

Using the token

Send the returned access_token on every GAINSConnect request:

curl https://<your-environment>.gainsystems.com/api/v1/customers \
  -H "Authorization: Bearer <access_token>"

Did this page help you?