Hello Giovanni,
I’ve just released version 2.2.0
.
Here you have a new API endpoint to validate the JWT.
You just have to make a GET
on auth/validate
and attach the JWT to the request, and this endpoint will read the plugin configuration, and validate your JWT.
The response will look something like this:
{
"success": true,
"data": {
"user": {
"ID": "123",
"user_login": "someemail@test.com",
"user_nicename": "test",
"user_email": "someemail@test.com",
"user_url": "",
"user_registered": "2020-06-29 15:29:22",
"user_activation_key": "",
"user_status": "0",
"display_name": "someemail@test.com"
},
"jwt": [
{
"token": "JWT_WILL_BE_HERE",
"header": {
"typ": "JWT",
"alg": "HS256"
},
"payload": {
"iat": 1593449136,
"exp": 1593452736,
"email": "someemail@test.com",
"id": 123,
"site": "https://localhost:81/wordpress4.9.12"
},
"expire_in": 3598
}
]
}
}
The error message will look something like this:
{
"success": false,
"data": {
"message": "The
jwt
parameter is missing.",
"errorCode": 53
}
}
Also, If the JWT payload will not be compatible with the plugin configuration, you can also get an error like this:
`
{
“success”: false,
“data”: {
“message”: “Unable to find user email123 property in JWT.”,
“errorCode”: 30
}
}
This means that, in your JWT payload, there is no email123
parameter.
The settings that you make in the Login
settings section, will have to be compatible with the JWT payload.
Please let me know if this fits your needs.
Also, if you have any other questions, don’t hesitate to write to me.
Have a nice week.
Nicu.