OAuth flow

Below is a description of each step in the OAuth authorization code flow (and refresh token flow).

This endpoint is triggered by the user opening this page in their browser with the following query parameters in the URL. The user will be presented with the option to authorize your app access to the user's Med2Lab account. If approved, your app will receive an authorization code in return. In the next request, you will exchange that code for an actual access token via a server-side call.

Initialize OAuth flow.

POST http://dev-api.med2lab.com/o/token/

Redirect the user to this URL with the following query parameters to start the OAuth flow. Once the user approves access (or if they have already approved), the user will be redirected to the appropriate redirect URI (specified in the app's configuration) with an authorization code that can be exchanged for an access token.

Request Body

Name
Type
Description

grant_type*

string

Authorization code

username*

string

user name

password*

string

password

client_id*

string

App ID

client_secret*

App Secret

{
    "access_token": "k5XBpu3GGIAgSpm4Z4Al8nDsWLkvF0",
    "expires_in": 36000,
    "token_type": "Bearer",
    "scope": "read write",
    "refresh_token": "88eoh1kVZFQcVEX0Zz29Urd4IQ6G2r"
}

Example

Lets setup the HTTP POST request

In the Body tab, enter your credentials as bellow.

grant_type: password
client_id: <client_id>
client_secret: <client_secret>
username: <username>
password: <password>

Last updated