validate_jwt
This endpoint allows you to verify valid JSON Web Token JWT. The generated token will include user cookie, ID, and username, apart from expiry and domain and other information.
You can also use this endpoint to login to the website using valid JWT. just provide ‘web_login’ parameters with the request.
In addition to the token signature verification, this end point will also verify if the cookie is valid or not. Internally, cookie will be used to identify to user.
There are three ways you can send the values to the endpoint:
- With standard Post method
- With the header Authorization: Bearer Token
- With the JSON raw body data format
Please see Postman screenshot for all three requests.
With standard Post method:
With the header Authorization: Bearer Token:
With the JSON raw body data format:
Resource URL
http://localhost/api/userplus/validate_jwt/
Method
POST
Required Parameters
- jwt
- key – get API key from Settings > User Plus
Optional Parameters
- web_login - this will redirect and login user to the website using valid jwt.
Sample Request URL
http://localhost/api/userplus/validate_jwt/?key=KEY-HERE&jwt=TOKEN-HERE
Sample Response
{
"status": "ok",
"jwt": {
"iat": 1594387374,
"iss": "www.wppim.com",
"nbf": 1594387434,
"exp": 1595597034,
"user": {
"id": 1,
"username": "sample-user",
"cookie": "sample-user|1595597034|huDz6GmB6xXTpxn6699M4OICbG6m6yJve4Gg8|17d43fce1fa6b5657f9baf7089ca4d9285667d1e06099b5d21688f6948f5b633"
}
},
"cookie_valid": true
}