Renew your token (JWT)
Endpointβ
https://api.verifik.co/v2/auth/session
This method is responsible for renewing the access token generated using other login endpoints, which has a validity period of 30 days. After this period, it is necessary to generate a new Access Token. The only parameter required for renewal is the previous access token, as long as it has not expired. This service only renews tokens that are still valid.
Headersβ
| Name | Value |
|---|---|
| Authorization | <token> |
Parametersβ
| Name | Type | Required | Description |
|---|---|---|---|
origin | string | No | Define what we are going to do with the token. In this case, the action will be "refresh". |
expiresIn | number | No | Number that can range from 1 to any number you wish. Each multiple represents a month, meaning 1: 1 month, 2: two months, 100: 100 months. |
Requestβ
- JavaScript
- Python
- Swift
- PHP
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://api.verifik.co/v2/auth/session',
params: {origin: 'refresh', expiresIn: 120},
headers: {
Authorization: '<token>'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
import http.client
conn = http.client.HTTPSConnection("api.verifik.co")
headers = {
'Authorization': '<token>'
}
conn.request("GET", "/v2/auth/session?origin=refresh&expiresIn=120", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import Foundation
let headers = [
"Authorization": "<token>"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.verifik.co/v2/auth/session?origin=refresh&expiresIn=120")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.verifik.co/v2/auth/session?origin=refresh&expiresIn=120', [
'headers' => [
'Authorization' => '<token>',
],
]);
echo $response->getBody();
Responseβ
- 200
- 401
- 409
{
"accessToken": "eyJhbGcpXVCJ9.eyJjbGllbnR...JZCIYiUzNjEaIWxYShWeBaRs",
"tokenType": "bearer"
}
{
"code": "Unauthorized",
"message": "Invalid or expired token.",
"signature": {
"dateTime": "August 31, 2022 3:24 PM",
"message": "Certified by Verifik.co"
}
}
{
"code": "MissingParameter",
"message": "missing Authorization header"
}
Featuresβ
- Token Renewal: Renew access tokens to extend their validity period
- 30-Day Validity: Extended tokens remain valid for 30 days
- Simple Process: Only requires the existing valid token
- Structured Response: Organized data format for easy integration
- Multiple Programming Languages: Support for JavaScript, Python, PHP, and Swift
- Error Handling: Comprehensive error responses for various scenarios