Glue API: Authenticating as a company user
Edit on GitHub
This page describes the API endpoint contract, which is the same regardless of the serving infrastructure. Storefront API endpoints are served by API Platform (recommended) or the legacy Glue infrastructure; Backend API endpoints currently run on the Glue infrastructure.
This endpoint allows authenticating as a company user.
Installation
For detailed information on the modules that provide the API functionality and related installation instructions, see Install the Company account Glue API.
Authenticate as a company user
To authenticate as a company user, send the request:
POST /company-user-access-tokens
| HEADER KEY | REQUIRED | DESCRIPTION |
|---|---|---|
| Authorization | ✓ | Alphanumeric string that authorizes the customer to send requests to protected resources. Get it by authenticating as a customer. |
Request
Request sample: authenticate as a company user
POST https://glue.mysprykershop.com/company-user-access-tokens
{
"data": {
"type": "company-user-access-tokens",
"attributes": {
"idCompanyUser": "5daf27b3-eddf-5b81-98cb-899f140f97e5"
}
}
}
| ATTRIBUTE | TYPE | DESCRIPTION |
|---|---|---|
| idCompanyUser | String | Unique identifier of a company user to authenticate as. To get it, Retrieve available company users. |
Response
Response sample: authenticate as a company user
{
"data": {
"type": "company-user-access-tokens",
"id": null,
"attributes": {
"tokenType": "Bearer",
"expiresIn": 28800,
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUz",
"refreshToken": "def50200d7338763c798a0600f18e"
},
"links": {
"self": "https://glue.mysprykershop.com/company-user-access-tokens"
}
}
}
| ATTRIBUTE | TYPE | DESCRIPTION |
|---|---|---|
| tokenType | String | Token type. The default value is Bearer. |
| accessToken | String | Authentication token used to send requests to the protected resources available for the company user. |
| expiresIn | Integer | Time in seconds in which the token expires. The default value is 28800. |
| refreshToken | String | Token used to refresh the accessToken. |
Possible errors
| CODE | REASON |
|---|---|
| 001 | Failed to authenticate a user. This can happen because of the following reasons:
|
| 002 | Authentication token is missing. |
| 901 | The idCompanyUser attribute is not specified, invalid, or empty. |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.
Next steps
Thank you!
For submitting the form