get https://example.com/auth
Check whether the authorisation token obtained from SAFE Launcher is still valid.
Applications can cache their authorisation token to avoid making unnecessary authorisation requests to SAFE Launcher. Applications can invoke this API to confirm whether their authorisation token is still valid.
The Authorization header must be present in the request.
Request Header
Authorization: Bearer <TOKEN>
Response
Ok
Unauthorized
Examples
var request = require('request');
var endPoint = 'http://localhost:8100/auth';
var onResponse = function(err, response, body) {
if (err) {
return console.error(err.message);
}
if (response.statusCode === 200) {
return console.log('Token valid');
}
console.error('Invalid token.', body);
};
request.get(endPoint, {
auth: {
bearer: constants.token // pass the auth token
}
}, onResponse);