Token Info Endpoint
This is a simple access token validation endpoint that can use to test access tokens' validity and the amount of expiration time left on the token. I modeled this endpoint from Google's validity access token endpoint.
For this to work you will need to install the Advanced Rest Client for some of these steps.
Install dependencies and run the authorization node server
cd Oauth2orizeRecipes/authorization-server
npm install
node app.js
If you open your browser and go to
https://localhost:3000
You should see the plain text of
OAuth 2.0 Authorization Server
which means it's up and running. Use any of the grant types to get a valid access token and then put that access token into the endpoint of
https://localhost:3000/api/tokeninfo?access_token=(your access token here)
and if successful you will see a json message of
{
"audience": "abc123",
"expires_in": 3109
}
Where audience is the client id and the expires_in is the amount of time in seconds left before the token expires.
If the token has expired or has been revoked, you will get a status cod of 400 Bad Request and the JSON message of
{
"error": "invalid_token"
}