Download OpenAPI specification:Download
API document for nb-auth-service default adapter
API document for auth service default adapter. Include the following functions:
enableRefreshToken
), some of the functions may not be available.Login use email and password.
Validations
- This endpoint have no authentication
- This endpoint have no authorization
request body to login
email required | string <email> (email.field) |
password required | string (password.field) >= 8 characters |
fingerprint required | string (fingerprint.field) |
{- "email": "user@example-email.com",
- "password": "password1",
- "fingerprint": "xxxxxxxxxx"
}
{- "userId": "userId",
- "accessToken": "token",
- "refreshToken": "refreshToken"
}
Logout from system (only for cookie based authentication). The logout endpoint will invalidate the session cookie, by setting the cookie's maxAge to 0.
If the authType of auth-service is not cookie, this endpoint will return 404.
userId required | string^[0-9a-z]{24}$ Example: 0123456789ab0123456789ab A unique identifier of an user. |
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}
Check if one token is validate token.
Client can check the token to obtain token information. For example, after login, check the token to obtain userId. After get one-time-token, check the token to verify it is valid or not.
If token is one-time-token, it will make it invalid after the check.
Validations
- If the token is user accessToken, no validaion needed
- If the token is onetimeToken, only app user (internal service) are allowed to do the check
- If the token type is neither accessToken nor onetimeToken, it will return 403
request body to check token
token required | string (token.field) nb-token(encrypted JWT token) |
fingerprint | string (fingerprint.field) |
target | string (target.field) path |
{- "token": "string",
- "fingerprint": "string",
- "target": "/"
}
null
Make one stateful token invalidate
Validations
- valid Authorization token have been specified in the request header
- Authorization token must be internal token
request body to invalidate token
token required | string (token.field) nb-token(encrypted JWT token) |
fingerprint | string (fingerprint.field) |
target | string (target.field) path |
{- "token": "string",
- "fingerprint": "string",
- "target": "/"
}
{- "token": "token"
}
Rollback the invalidate_token process. Make a stateful token invalidated by POST /invalidate_token endpoint valid.
Validations
- valid Authorization token have been specified in the request header
- Authorization token must be internal token
request body to restore token
token required | string (token.field) nb-token(encrypted JWT token) |
fingerprint | string (fingerprint.field) |
target | string (target.field) path |
{- "token": "string",
- "fingerprint": "string",
- "target": "/"
}
{- "token": "token"
}
Generate onetime stateful token. This token can be passed to user, for some authentication process.
For example, user can use this token to reset password, or to verify email.
Validations
- valid Authorization token have been specified in the request header
- Authorization token must be internal token
request body to generate onetime token
fingerprint | string (fingerprint.field) |
target | string (target.field) path |
data | object custom data |
{- "fingerprint": "string",
- "target": "/",
- "data": { }
}
{- "token": "token"
}
Login using onetime login.
Validations
- This endpoint have no authentication
- This endpoint have no authorization
request body for onetime login
onetimeToken required | string (token.field) nb-token(encrypted JWT token) |
fingerprint required | string (fingerprint.field) |
{- "onetimeToken": "onetime-token",
- "fingerprint": "fingerprint"
}
{- "userId": "userId",
- "accessToken": "token",
- "refreshToken": "refreshToken"
}
Generate a new access token using refreshToken.
Validations
- fingerprint need to be specified in the request body
- valid refreshToken need to be specified in the request body
- fingerprint / refreshToken combination must be valid
request body to generate new access token with refresh token
fingerprint | string (fingerprint.field) |
refreshToken | string (token.field) nb-token(encrypted JWT token) |
{- "fingerprint": "string",
- "refreshToken": "string"
}
{- "accessToken": "token"
}
Delete the refresh token for user.
Validations
- Authorization token must be internal token
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}
Check if onetime code is match with the one stored in onetime-token or not.
If code is a match, return user id, access token, and refresh token.
Validations
- This endpoint have no authentication
- This endpoint have no authorization
request body to check code
token required | string (token.field) nb-token(encrypted JWT token) |
code required | string (code.field) random digit genereated send to user |
{- "token": "string",
- "code": "string"
}
{- "userId": "userId",
- "accessToken": "token",
- "refreshToken": "refreshToken"
}
Check onetime token and extract user info and invalidate the token.
Regenerate two factor code and send it to user.
Validations
- valid Authorization token have been specified in the request header
resend two factor code to user
token required | Object (onetimeToken.field) data encoded in onetime token. The format depends on what encoded in generate onetime token request. |
{- "token": { }
}
{- "accessToken": { }
}
Requesting this endpoint will redirect you to Google OAuth2 login page
fingerprint | string fingerprint of client machine |
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}
Requesting this endpoint will redirect you to Apple OAuth2 login page
fingerprint | string fingerprint of client machine |
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}
Requesting this endpoint will redirect you to Line OAuth2 login page
fingerprint | string fingerprint of client machine |
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}
Requesting this endpoint will redirect you to Twitter OAuth2 login page
fingerprint | string fingerprint of client machine |
{- "error": {
- "code": "string",
- "message": "string",
- "target": "string",
- "details": [
- {
- "code": "string",
- "target": "string",
- "message": "string"
}
]
}
}