Oauth2 Authorization

Production Env

https://api.nuvosphere.io

Staging Env

https://api.staging.nuvosphere.io

Step1 - Initiate authorization

Request for log in

`${host}/#/oauth2-login?switch_account=${switchAccount}&app_id=${appId}&return_url=${encodeURIComponent(returnUrl)}`

description

switch_account:  switch user account
app_id        :  Nuvo middleware app id
return_url    :  Nuvo middleware Authorized Domains

Step2 - Receive authorized code

After initiating authorization, Nuvo will return_url and code

https://demo.dapp.com/callback?code=xxxxxxx

The developer will receive url(https://demo.dapp.com/callback), keep the code for the access token use

Step3 - Request Access Token

Request access token

GET /api/v1/oauth2/access_token

Query String: ?appid={appid}&code={code}

code: the code kept from step2

appid: app id that can be acquired from Nuvo One

Request Body

NameTypeDescription

code*

String

the code kept from step2

appid*

String

Nuvo middleware app id

{
    "code": 200,
    "data": {
        "accessToken": "a7f4216020364aa79d77e18d4965cf2f", //authorized token,use this token to access related api
        "appId": "60ed992bb520d95b454c4e88",
        "expiresIn": 43200, //valid for 12 hours
        "refreshToken": "aab3accb1180410fbe9341fd0db95d94", //Refresh time 30 days
        "wcSession": null
    },
    "msg": ""
}

Last updated