OAuth User

OAuth User to authenticate a user

Previous Step: Create User to get the oauth_key and refresh_token.

We use a variation of OAuth 2.0 for authentication. This means, to perform an action for a user, you need to supply a valid OAuth Key in the header field of the API request. Read more about what to include in our headers on our API initialization page.

OAuth Key currently expires in two hours. After OAuth Key expires, you can use the refresh token to generate a new OAuth Key. When the OAuth Key is refreshed, a new refresh token might be issued as well.

Refresh tokens expire after ten uses and update periodically. We manage this complexity for you. To get the most recent Refresh token, View the User.

API ENDPOINT

https://uat-api.synapsefi.com/v3.1/oauth/:user_id

PATH PARAMETERS

user_id :
required
string

ID of user

BODY PARAMETER

refresh_token :
required
string

The current refresh token associated with the user

scope :
array of strings

OAuth key scope

phone_number :
string

Phone number for 2FA

validation_pin :
string

Validation Pin for 2FA

Additional Tips

  • Refresh tokens expire after ten uses and update periodically. We manage this complexity for you. To get the most recent Refresh token, do a GET on user.
  • OAuth Key currently expires in ten hours. After OAuth Key expires, you can use the refresh token to generate a new OAuth Key. When the OAuth Key is refreshed, a new refresh token might be issued as well.
  • If you OAuth with a new device, you may need to register a new device fingerprint.

EXAMPLE REQUEST

POST /v3.1/oauth/594e0fa2838454002ea317a0 HTTP/1.1
Host: uat-api.synapsefi.com
X-SP-GATEWAY: client_id_2bb1e412edd311e6bd04e285d6015267|client_secret_2bb1e714edd311e6bd04e285d6015267
X-SP-USER-IP: 127.0.0.1
X-SP-USER: |e83cf6ddcf778e37bfe3d48fc78a6502062fc
Content-Type: application/json

{
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq"
}
POST /v3.1/oauth/594e0fa2838454002ea317a0 HTTP/1.1
Host: uat-api.synapsefi.com
X-SP-GATEWAY: client_id_2bb1e412edd311e6bd04e285d6015267|client_secret_2bb1e714edd311e6bd04e285d6015267
X-SP-USER-IP: 127.0.0.1
X-SP-USER: |e83cf6ddcf778e37bfe3d48fc78a6502062fc
Content-Type: application/json

{
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "scope":[
        "NODES|POST",
        "NODES|GET",
        "NODE|GET",
        "TRANS|POST"
    ]
}
body = {
    "refresh_token":"refresh_Y5beJdBLtgvply3KIzrh72UxWMEqiTNoVAfDs98G",
    "scope":[
        "USER|PATCH",
        "USER|GET",
        ...
    ]
}

user.oauth(body)
const body = {
  refresh_token: '<REFRESH_TOKEN>'
};

user._oauthUser(body);
scope = {
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "scope":[
        "NODES|POST",
        "NODES|GET",
        "NODE|GET",
        "TRANS|POST"
    ]
}

user.authenticate(scope: scope)
$body = (object) [
   "refresh_token" => "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq"
];

$user->ouath($body);
body = `{
    "refresh_token":"refresh_Y5beJdBLtgvply3KIzrh72UxWMEqiTNoVAfDs98G",
    "scope":[
        "USER|PATCH",
        "USER|GET",
        ...
    ]
}`

data, err := client.Authenticate(body)

EXAMPLE SUCCESSFUL 200 RESPONSE

{
    "client_id": "589acd9ecb3cd400fa75ac06",
    "client_name": "SynapseFI",
    "expires_at": "1498297390",
    "expires_in": "7200",
    "oauth_key": "oauth_bo4WXMIT5V0zKSRLYcqNwGtHZEDaA1k3pBv7r20s",
    "refresh_expires_in": 8,
    "refresh_token": "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "scope": [
        "USER|PATCH",
        "USER|GET",
        "NODES|POST",
        "NODES|GET",
        "NODE|GET",
        "NODE|PATCH",
        "NODE|DELETE",
        "TRANS|POST",
        "TRANS|GET",
        "TRAN|GET",
        "TRAN|PATCH",
        "TRAN|DELETE",
      	"STATEMENTS|GET",
				"STATEMENT|GET"
    ],
    "user_id": "594e0fa2838454002ea317a0"
}
{
    "client_id": "589acd9ecb3cd400fa75ac06",
    "client_name": "SynapseFI",
    "expires_at": "1498297511",
    "expires_in": "7200",
    "oauth_key": "oauth_YRiB3K1opexAkltDZvc4QOEMnLSCJ8m0UN6Gasyq",
    "refresh_expires_in": 7,
    "refresh_token": "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "scope": [
        "NODES|POST",
        "NODES|GET",
        "NODE|GET",
        "TRANS|POST"
    ],
    "user_id": "594e0fa2838454002ea317a0"
}

OAuth Scopes

Scope
Comment

USER|PATCH

OAuth can be used to update User document

USER|GET

OAuth can be used to get User

NODES|POST

OAuth can be used to add Nodes

NODES|GET

OAuth can be used to get Nodes

NODE|GET

OAuth can be used to get Node

NODE|PATCH

OAuth can be used to update Node

NODE|DELETE

OAuth can be used to delete Node

TRANS|POST

OAuth can be used to add Transaction

TRANS|GET

OAuth can be used to get Transaction

TRAN|GET

OAuth can be used to get Transaction

TRAN|PATCH

OAuth can be used to update Transaction

TRAN|DELETE

OAuth can be used to cancel Transaction

SUBNETS|POST

OAuth can be used to create Subnets

SUBNETS|GET

OAuth can be used to get Subnets

SUBNET|GET

OAuth can be used to get a Subnet

SUBNET|PATCH

OAuth can be used to update a Subnet

STATEMENTS|GET

OAuth can be used to get Statements

STATEMENT|GET

OAuth can be used to get a Statement

*Next Step: Add User KYC to add new base documents or sub-document.