Bearer tokens
PlaceOS is an OAuth2 authentication service provider. These are a few ways to obtain a bearer token
Bearer tokens are tied to client applications. You can find the list of configured applications in Backoffice on the Domains -> Applications tab.
Password Flow
NOTE:: this flow is not recommended and only works for services accounts, it can be useful to obtain a token simply for testing.
POST /auth/oauth/token
This will return a new token
you can specify more than one scope - defaults to public
the scopes selected here must be a subset of those configured on the client application
Making Requests
There are three ways to make an authenticated request with a bearer token:
A HTTP Header:
Authorization: Bearer <token>
A URL Param:
?bearer_token=<token>
A HTTP Cookie:
bearer_token=<token>
Inspect an existing token
GET /api/engine/v2/api_keys/inspect?bearer_token=yourtoken
GET /api/engine/v2/api_keys/inspect?api-key=yourkey
Authorisation Code Flow
This is the recommended flow for applications built on top of the PlaceOS platform. All PlaceOS templates additionally implement the PKCE extensions for additional security.
First a user session must be established, there are two methods to achieve this
Local login, POST
/auth/signin?email=service@account.com&password=developer
SSO login, GET
/auth/oauth2?id=oauth2-id
(generated as part of configuration)
Extract the user cookie (if performing programatically)
Perform the authorisation code flow to obtain a token, with the cookie header set
Authorise endpoint:
/auth/oauth/authorize
Token endpoint:
/auth/oauth/token
Last updated