Access Token
How to get the Access Token after the login process and how to use it

Obtaining Investor Access

The next step is to get the token for the issuer. Use the v1/{domainID}/oauth2/authorize endpoint, like:
curl -X POST "{baseUrl}" -H "accept: application/json" -H "Authorization: {secret}" -H "Content-Type: application/json" -d "{ \"code\": \"{code}\"}"
Parameter
Description
{domainID}
Your application client id provided by Securitize
authorization
Your application secret provided by Securitize
code
The Code you received in the previous set
post
https://sec-id-api.securitize.io
/v1/{clientId}/oauth2/authorize
Investor Authorization
JavaScript Example:
1
function requestToken() {
2
var issuerID = "STRING";
3
const baseUrl = "https://sec-id-api.sandbox.securitize.io/v1/"
4
+ issuerID + "/oauth2/authorize";
5
var scope = "info details verification";
6
var redirecturl = "STRING";
7
var OAuthSecret = "STRING";
8
9
// Get the CODE in the URL
10
const queryString = window.location.search;
11
const urlParams = new URLSearchParams(queryString);
12
const code = urlParams.get("code");
13
14
var data = JSON.stringify({
15
"code": code
16
});
17
18
var xhr = new XMLHttpRequest();
19
xhr.withCredentials = true;
20
21
xhr.addEventListener("readystatechange", function () {
22
if (this.readyState === 4) {
23
if (this.status === 200) {
24
// User is logged-in and has authorized the app
25
// Know we can get the TOKEN and start interacting
26
var response = JSON.parse(this.responseText);
27
console.log("Authorized with access Token: ", response.accessToken);
28
}
29
console.log(this.responseText);
30
}
31
});
32
xhr.open("POST", baseUrl);
33
xhr.setRequestHeader("Content-Type", "application/json");
34
xhr.setRequestHeader("Authorization", OAuthSecret);
35
xhr.send(data);
36
}
Copied!
Last modified 1yr ago