Point of Service API Authentication Flow
The Point of Service (POS) API admin panel uses Basic authentication and the OAuth Resource Owner Password Credentials (ROPC) Flow. To provide the proper experience for admins using the POS admin panel, you’ll need to provide the following capabilities:- Create an account
- Log in to the admin panel
- Refresh an account’s access token
Step 1: Create account
The user will first create their account for the POS admin client app.Request
The client sends an HTTP request to the/users endpoint, including the user_name, password, and grant_type properties in the request body.
Endpoint: POST /users
Response
If the request was successful, the server responds with a201 Created status code with the response body containing the new user account resource.
Step 2: Log in as the admin
Admin users will log into the admin portal to perform actions like creating users and dishes or adding/updating ingredients. To send requests to admin endpoints, the client app requires an access token which is obtained by making a POST call to the/auth/token endpoint.
Request
The client sends an HTTP request that includes a basic authorization header and the user’suser_name and password.
Endpoint: POST /auth/token
Response
If the request was successful, the server responds with a201 Created status code with an access token in the response body.
Response body properties:
Step 3: Refresh the access token
After theaccess_token expires, you can refresh the access token by sending a POST call to the /auth/refresh-token endpoint.
Request
The client sends an HTTP request using therefresh_token value in the authorization header.
Endpoint: POST /auth/refresh-token
Response
If the request was successful, the server responds with a201 Created status code with the response body containing the new access and refresh tokens.