Authentication
Send the token
Section titled “Send the token”Send your token as a bearer token on every request.
curl "https://app.ridebox.my/api/user" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Accept: application/json"Refresh before it expires
Section titled “Refresh before it expires”Refreshing returns a new token, with the same response as signing in, and revokes the one you sent. Save the new token straight away.
curl -X POST "https://app.ridebox.my/api/auth/refresh" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Accept: application/json"Revoke a token
Section titled “Revoke a token”curl -X POST "https://app.ridebox.my/api/auth/logout" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Accept: application/json"This returns 204 and ends that token only.
When a token stops working
Section titled “When a token stops working”A 401 response tells you what to do through its code field.
code |
Meaning | What to do |
|---|---|---|
token_expired |
The token passed its expires_at |
Sign in again |
token_revoked |
The token is no longer valid | Sign in again. Do not retry with this token |
No code |
No token was sent | Send the Authorization header |
Changing the account password signs out every other token.
What a token can reach
Section titled “What a token can reach”A token acts as the account that created it. Devices, rides and alerts owned by anyone else return 404.