Refresh User Token
Use this API to refresh the id_token
and the access_token
for the end user.
Limit
The refresh token can be used only once. If it has expired a new API call will need to be made.
Call
curl --request POST
--url https://api.ezid.io/verify/otp \
--header 'Content-Type: application/json' \
--data {
client_id: "your_client_id",
client_secret: "your_client_secret",
refresh_token: "68d62141-986b-462a-8715-a5783064d54e"
}
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));');
let url = 'https://api.ezid.io/send/otp';
let options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: {
client_id: "your_client_id",
client_secret: "your_client_secret",
refresh_token: "68d62141-986b-462a-8715-a5783064d54e"
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
Attributes | Definition |
---|---|
client_id* | Your companies unique ID, provided by EZiD |
client_secret* | You companies unique secret, provided by EZiD |
refresh_token | A valid refresh token returned to refresh your users browsing session |
Please note: the
refresh_token
required for this API call is as a part of the/verify
API call.
Responses:
{
access_token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzYWF0dmlrcnVkcmFwYXRuYUBnbWFpbC5jb20uZXppZC5pby83ZWM2MDJlNGQyZGIxMzQ3OTVhMzRjMDM4MDlmNzNlNiIsImlzcyI6Imh0dHBzOi8vZXppZC5pbyIsImF6cCI6IjdlYzYwMmU0ZDJkYjEzNDc5NWEzNGMwMzgwOWY3M2U2Iiwic2NvcGUiOiJvcGVuaW2gYWxsb3c6aW52aXRlIiwiY3VzdG9tX2NsYWltcyI6eyJyb2xlIjoicmVhZC1vbmx5LXVzZXIiLCJ0ZXN0IjoiZnJvbSBzZW5kIGVuZHBvaW50In0sImlhdCI6MTY0NTYwNzcyNSwiZXhwIjoxNjQ1NjQzNzI1fQ.Ucgo3lV6yGyB3odZPf8sgojGah9xsEO-EzNbNFoAAxVOwl-naS--ZN4mm9B8sZgAi-WIJOGC7LJFPhHI2ZwTp0oucIEljh_MT6GLWK8V7SJLgQP1XWgIZfpqqa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--hJWsQaX_CGpZ_CnaaQxh0M-CqWgnTnMdIHpwSKL59lvjpiNZ68PyvPiK4x37bRpKBQiiekqpqrhJ5wbjdGKkdIaOoS7dwHGNPsQcvWKN3GjcamxI9j-tpnff3Rj1It7ZtqITIvg9nIDNKtk--FSPPBbt_Jk0ksMZjstfjcsnbiW-cJW8E4HEhfbL2qUmgqPQMVYrmq-pTuXYq04nfru_o_cTeVGX-DN5aQcsqM6cQImJ5bBRqqGKTV0NhiFSIpFig7KUI9BMbi6vpDGFeYJNSIALTvrzHi4hB99LOv6shXY5lsHrDi2WJUESWzuBmODoUbBZDTo__4JtliLaY-uOu67lLG4iaX4kbD-tranDOE5QrWPiDe3NoKxam1l_5_2h3zRyPMLAIi-qScVA_s0_rAYYBih5QdgHnidOgHesv_DmP7SQt549TaYNxjOGAGq0K_yLkPpHRj3iTi8Zp_pSE1S-Qn7IAZ3WdcnoXz1QVprMlBAKhpaQ531Hh6HHltJrHy83axRXabTb-LhctXq5YQ8zbTBfw7e_DbYSaGc-_3LA-YELcr4cYucbHvC0",
refresh_token: "d71d7f03-0eca-4de2-b48d-a888d0de75d7",
}
{
success: false,
reason: "Client is not registered"
}
{
success: false,
reason: "invalid refresh token"
}
Attributes | Definition |
---|---|
access_token | This is the access token of the user. It is a token that contains private information about the user and their access rights. This should be stored securely such that it is not exposed. |
id_token | This is the ID token of the user. It is a token that contains their number amongst other details. This should be stored by the front-end of your application, and validated when the user tries to access protected resources |
refresh_token | The new refresh token. This can be used again for calling this endpoint |