Obtaining Authorization Tokens
POST /hosts/auth
Obtain the authentication header
Headers
Name | Value |
|---|---|
Content-Type |
|
Origin |
|
SITE_URL - The Authorized Site URL
This is the only request that does not require the Host Authorization Header for obvious reasons :smile:
Body
Name | Type | Description |
|---|---|---|
| string | CLIENT_ID provided by Annoto for SITE_URL |
| string | The Authorized SITE_URL |
| string | random string for identifying the visitor SESSION_ID |
| string | random string for identifying the site VISITOR_ID |
{ "client_id": "CLIENT_ID" "origin": "SITE_URL" "session_id": "SESSION_ID", "visitor_id": "VISITOR_ID"}
Response
200
{ "host_token": "HOST_JWT_AUTHORIZATION_TOKEN", "settings": { "enableSSO": true, "publicName": "OPTIONAL_PUBLIC_NAME_OF_THE_SITE", }, "name": "NAME_OF_THE_SITE"}
400
{ "message": "Bad request", "statusCode": 400}
401
{ "message": "Unauthorized", "statusCode": 401}
HOST_JWT_AUTHORIZATION_TOKEN - The JWT token to be used in Host Authorization Header
POST /auth/sso
Annoto supports various authentication strategies for users, eventually all the strategies yield the user authorization JWT token to be used by the APIs, this API is for SSO strategy.
Headers
Name | Value |
|---|---|
Content-Type |
|
Host-Authorization |
|
<token>- The HOST_JWT_AUTHORIZATION_TOKEN
Body
Name | Type | Description |
|---|---|---|
| string | the generated user SSO Token according to |
{ "token": "USER_SSO_JWT_TOKEN"}
Hints for generating the USER_SSO_JWT_TOKEN
For
scopeuse appropriate scope based on the permission requirements of the APIs to be used. For most APIssuper-modscope would be sufficient.For
namewe suggest using a naming convention such as:[System] Super Moderator
Response
200
{ "access_token": "USER_JWT_AUTHORIZATION_TOKEN", "scope": ["user"], "sso_id": "10024010", "permissions": { "hostScopes": [ "super-mod", "moderator", "member", "user" ], "scopes": [ "super-mod", "moderator", "member", "user" ] }}
400
{ "message": "Bad request", "statusCode": 400}
401
{ "message": "Unauthorized", "statusCode": 401}
USER_JWT_AUTHORIZATION_TOKEN - The User Authentication JWT token
USER_JWT_AUTHORIZATION_TOKEN is coupled to the host, and cannot be used for other hosts