Auth API (1.0.0-dev)

Download OpenAPI specification:

License: Propietary

Authentication

An API key and a set of credentials (email and password) must be used to authenticate. Use the /auth endpoint to get the short-lived token needed to call WeDoBooks apis endpoints.

The response also carries a refresh token and the lifetime of the id token in seconds (expiresIn, currently 3600). Store the refresh token and call /auth/refresh shortly before the id token expires to obtain a new one — around 50 minutes after it was issued — instead of sending the credentials again on every call. The refresh token itself stays valid until the user password changes or the user is disabled; when it stops working, authenticate again with the credentials.

Authenticate user

Authenticate with username/password provided by WedoBooks in order to obtain a short lived JWT token used to access other endpoints

The token will expire after 1hs. Use the returned refresh token on the /auth/refresh endpoint to get a new one before it expires, instead of authenticating with the credentials again.

Authorizations:
api_key
Request Body schema: application/json
required

userCredentials

email
required
string <= 50 characters
password
required
string <= 50 characters

Responses

Request samples

Content type
application/json
{
  • "email": "dev-demo@wedobooks.io",
  • "password": "test-demo"
}

Response samples

Content type
application/json
{
  • "idToken": "string",
  • "refreshToken": "string",
  • "expiresIn": 0
}

Refresh token

Exchange the refresh token obtained from the /auth endpoint for a new short lived JWT token

The refresh token stays valid until the user password changes or the user is disabled, so it can be reused every time the id token is about to expire. Refresh shortly before the hour is up rather than after a request fails.

Authorizations:
api_key
Request Body schema: application/json
required

refreshTokenRequest

refreshToken
required
string [ 1 .. 2048 ] characters

The refresh token returned by the authenticate endpoint.

Responses

Request samples

Content type
application/json
{
  • "refreshToken": "AMf-vBxT0T4rIeVYourRefreshTokenHere"
}

Response samples

Content type
application/json
{
  • "idToken": "string",
  • "refreshToken": "string",
  • "expiresIn": 0
}