Skip to main content

Refresh token

You can use this endpoint in order to refresh an expired token.

METHOD : POST

ENDPOINT: /simple-jwt-login/v1/auth/refresh

URL Example: https://{{yoursite}}/?rest_route=/simple-jwt-login/v1/auth/refresh&JWT={{YOUR_JWT}}

PARAMETERS:

ParameterTypeDescription
JWTrequired stringYour JWT
AUTH_CODEoptional stringAuth Code from the "Auth codes" section. Required only if "Authentication Requires Auth Code" is enabled.

Request

{
"JWT" : "YOUR_JWT_HERE",
"AUTH_CODE": "MySecretAuthCode"
}

Responses

200

 {
"success": true,
"data": {
"jwt": "NEW_GENERATED_JWT_HERE"
}
}

400

{
"success": false,
"error" : "Error message"
}

Examples

SHELL

    curl -X POST https://simplejwtlogin.com/?rest_route=/simple-jwt-login/v1/auth/refresh -d '{"JWT":"YOUR_EXPIRED_JWT"}'

PHP

    $simpleJwtLogin = new SimpleJwtLoginClient'https://mydomain.com', '/simple-jwt-login/v1');
$result = $simpleJwtLogin->refreshToken('your JWT here', 'AUTH CODE');

Screenshot

Features

Refresh time to live

You can specify the length of time (in minutes) that the token can be refreshed within.

For example, the user can refresh their token within a 2-week window of the original token being created until they must re-authenticate.

Defaults value is set to 2 weeks.