OAuth
Authenticate users as a liquid user by briefly redirecting the browser to a specified url.

Structure

In the context of QEX, OAuth can only be used to authenticate a session generated by the QEX API. This session can then be used to query the QEX API and/or initialize a widget integration.

Usage

1. Create Session

A session can be created via API.
1
POST https://partners.liquid.com/api/v1/session
2
{
3
"public_api_key": "pk_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
4
}
5
6
200
7
{
8
"success":true,
9
"environment":"PRODUCTION",
10
"message":"Session created.",
11
"payload":{
12
"public_api_key":"pk_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
13
"session_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
14
"session_secret":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
15
"environment":"PRODUCTION",
16
"client_info":{
17
"ip_country":"JP"
18
},
19
"_links":{
20
"terms_of_service":{
21
"href":"https://help.liquid.com/en/articles/3969828-quick-exchange-by-liquid-end-user-terms-of-use"
22
}
23
}
24
}
25
}
Copied!

2. Associate session to User

Once a session has been created it can be associated with a user by having them approve the OAuth request. This is done by opening a browser window to the URL below.
1
https://partners.liquid.com/api/v1/session/{session_id}/liquid_oauth
Copied!
Note: when OAuth is completed the user will be presented with an instruction to close the web browser and manually return to your app.
This can alternatively redirect the user to a specified URL or deep link.

3. Fetch user account balances

The authenticated session can now be used to query the user account balances. See Authorization.
1
GET https://partners.liquid.com/api/v1/session/${session_id}/accounts
2
Authorization: Bearer {jwt}
Copied!

4. Initialize Widget

The session id/key can be passed into the widget. This will cause the widget to assume the session of the user authenticated earlier.
1
{
2
"public_api_key": "pk_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
3
...
4
"identity": {
5
"user_session": {
6
"session_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
7
"session_secret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
8
}
9
}
10
}
Copied!
Last modified 8mo ago
Copy link