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 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.
userCredentials
| email required | string <= 50 characters |
| password required | string <= 50 characters |
{- "email": "dev-demo@wedobooks.io",
- "password": "test-demo"
}{- "idToken": "string",
- "refreshToken": "string",
- "expiresIn": 0
}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.
refreshTokenRequest
| refreshToken required | string [ 1 .. 2048 ] characters The refresh token returned by the authenticate endpoint. |
{- "refreshToken": "AMf-vBxT0T4rIeVYourRefreshTokenHere"
}{- "idToken": "string",
- "refreshToken": "string",
- "expiresIn": 0
}