Get an Access Token

You need to implement the logic associated with the steps 7 and 8 in "Figure OAuth 2.0 based SSO between LINE WORKS and the customer" and the steps 5 and 6 in "Figure OAuth 2.0 based API authentication" and provide it as an API to LINE WORKS. After verifying the authorization code, the customer's SSO system issues and returns an access token.

Request URL {#access-token-request-url}

https://CustomerDomain/accessToken

You can only use port 80 or 443 according to LINE WORKS's infrastructure security policy.
Register the request URL in Access Token Return API under SSO > WORKS as SP in the Developer Console.

Figure Add OAuth 2.0 based Access Token Return API

Figure Add OAuth 2.0 based Access Token Return API

Note

  • When an access token is issued, the session expiration time is determined by the expires_in value; if expires_in is not specified, the default login retention period is set to 24 hours (web browser) and 30 days (mobile app and desktop app).
  • For the public APIs, the default retention period is 1 hour (web browser), 24 hours (mobile app), and 30 days (desktop app).

HTTP method {#access-token-request-method}

POST

Request {#access-token-request-body}

Note

  • During API communication, the connection timeout is 1 second and the read timeout is 3 seconds.
ParameterTypeRequiredDescription
grant_typeStringYA value to specify the response type.
Set this parameter to "authorization_code".
client_idStringYThe client ID registered in the Developer Console
client_secretStringYThe client secret registered in the Developer Console
codeStringYAuthorization code

Response {#access-token-response}

The response is formatted as JSON.

PropertyTypeRequiredDescription
access_tokenStringY (if successful)Access token
refresh_tokenStringNA token to renew the access token that expired.
token_typeStringY (if successful)Access token type.
It is "Bearer".
expires_inString/IntegerY (if successful)The validity period of the access token (in seconds).
Login retention period of the application.
errorStringY (if it fails)Error code returned on failure
error_descriptionStringY (if it fails)Error description returned on failure

Error code {#access-token-response-error-code}

CodeMessageDescription
101access_deniedRequest from unauthorized client
201invalid_requestMissing or invalid request
203unsupported_grant_typeThe grant_type is not supported.
301unauthorized_clientInvalid client ID or secret
302invalid_authorizationInvalid authorization code