- 27 Jun 2024
- 6 Minutes to read
- Print
- DarkLight
Sign In and Authentication
- Updated on 27 Jun 2024
- 6 Minutes to read
- Print
- DarkLight
API calls and sample responses pertaining to sign in, sign out and authentication are listed below.
User Sign In & JWT Token Generation
Use this call to authenticate a user and retrieve access tokens.
Endpoint: POST https://api.volumez.com/signin
Headers:
Content-Type: application/json
Request Body:
{
"email": "string",
"password": "string",
}
Sample Request:
curl -X POST https://api.volumez.com/signin \
-H 'Content-Type: application/json' \
-d '{
"email": "demo@volumez.com",
"password": "********"
}'
Response:
Field | Type | Description |
AccessToken | string | Token used for accessing protected routes |
IdToken | string | JWT containing user identity information |
RefreshToken | string | Token used to obtain new access tokens |
ExpiresIn | number | Token expiration time in seconds |
TokenType | string | Type of token (e.g., "Bearer") |
Sample Response:
{
"AccessToken": "eyJraWQiOi...",
"IdToken": "eyJr...",
"RefreshToken": "eyJjd...",
"ExpiresIn": 86400,
"TokenType": "Bearer"
}
Usage Note: We’ve extracted the JWT token as “IdToken” and used that parameter in the following API calls.
curl -X POST https://api.volumez.com/signin \
-H 'Content-Type: application/json' \
-d '{"email":"demo@volumez.com", "password":"********"}' \
| jq -r '.IdToken'
This command uses jq to parse the JSON response and extract the IdToken value.
User Sign Out
This call signs out users from all devices. It also invalidates all refresh tokens issued to a user. The user's current Access and Id tokens remain valid until their expiry.
curl -X POST https://api.volumez.com/signout -H 'content-type: application/json' -d '{"AccessToken":"<token>"
}'
User Sign Out: Response
{}