Simple JWT Login (1.0.0)
Download OpenAPI specification:Download
This is the Simple JWT Login WordPress plugin API Documentation.
This API is documented in OpenAPI format. You can either open it in swagger editor or you can view it on this website.
Also, you open it in postman, and you will be able to do local tests.
You can access the Simple JWT Login API in two modes:
- using permalink: https://{domain}/wp-json/simple-jwt-login/v1/{endpoint}
- using rest_route: https://{domain}/?rest_route=/simple-jwt-login/v1/{endpoint}
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
Autologin user into WordPress
query Parameters
JWT required | string Example: JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c JWT |
AUTH_CODE | string Example: AUTH_CODE=MY_SUPER_SECRET_AUTH_CODE Required when "Auto-Login Requires Auth Code" is enabled |
redirectUrl | string Example: redirectUrl=https://simplejwtlogin.com If this parameter is provided, this will overwrite the redirect URL set in the plugin settings. Also, please make sure you check the option from plugin settings. |
Responses
Response samples
- 200
- 400
Register WordPress user
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Register WordPress user
email required | string User email address |
password required | string User password |
user_login | string The user's login username. |
user_nicename | string User URL-friendly username |
user_url | string User URL |
display_name | string The user's display name. Default is the user's username. |
nickname | string The user's nickname. Default is the user's username. |
first_name | string The user's first name. For new users, will be used to build the first part of the user's display name if "display_name" is not specified. |
last_name | string The user's last name. For new users, will be used to build the second part of the user's display name if "display_name" is not specified. |
description | string The user's biographical description. |
rich_editing | string Whether to enable the rich-editor for the user. Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'. |
syntax_highlighting | string Whether to enable the rich code editor for the user. Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'. |
comment_shortcuts | string Whether to enable comment moderation keyboard shortcuts for the user. Accepts 'true' or 'false' as a string literal, not boolean. Default 'false'. |
admin_color | string Admin color scheme for the user. Default 'fresh'. |
use_ssl | boolean Whether the user should always access the admin over https. Default false. |
user_registered | string Date the user registered. Format is 'Y-m-d H:m:s'. |
user_activation_key | string Password reset key. Default empty. |
spam | boolean Multisite only. Whether the user is marked as spam. Default false. |
show_admin_bar_front | string Whether to display the Admin Bar for the user on the site's front end.Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'. |
locale | string User's locale. Default empty. |
Responses
Request samples
- Payload
{- "email": "test@simplejwtlogin.com",
- "password": "string",
- "user_login": "myuser",
- "user_nicename": "myuser",
- "display_name": "myuser",
- "nickname": "myuser",
- "first_name": "myuser",
- "last_name": "myuser",
- "description": "This is a sample description",
- "rich_editing": true,
- "syntax_highlighting": true,
- "comment_shortcuts": false,
- "admin_color": "fresh",
- "use_ssl": true,
- "user_registered": "2022-01-31 23:15:30",
- "user_activation_key": "string",
- "spam": false,
- "show_admin_bar_front": true,
- "locale": ""
}
Response samples
- 200
- 400
{- "success": true,
- "id": 1,
- "message": "User was successfully created.",
- "user": {
- "ID": 1,
- "user_login": "myusser",
- "user_nicename": "My User",
- "user_email": "myuser@simplejwtlogin.com",
- "user_registered": "2021-01-01 23:31:50",
- "user_activation_key": "test",
- "user_status": "0",
- "display_name": "myuser",
- "user_level": 10
}, - "roles": {
- "0": "administrator"
}, - "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Delete WordPress user
query Parameters
JWT required | string Example: JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c JWT |
AUTH_CODE | string Example: AUTH_CODE=MY_SUPER_SECRET_AUTH_CODE Required when "Delete User Requires Auth Code" is enabled |
Responses
Response samples
- 200
- 400
{- "message": "User was successfully deleted.",
- "id": 1
}
Send reset password code
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Send an email with the reset password code to the user
string | |
AUTH_CODE | string Required when "AuthenticationReset Password Requires Auth Code" is enabled |
Responses
Request samples
- Payload
{- "email": "contact@simplejwtlogin.com",
- "AUTH_CODE": "MY_SUPER_SECRET_AUTH_CODE"
}
Response samples
- 200
- 400
{- "success": true,
- "message": "Reset password email has been sent."
}
Change user password
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Change the user password
string | |
code | string |
new_password | string |
JWT | any In order to reset password with JWT, you need to check "Allow Reset password with JWT". If a JWT is provided, the |
AUTH_CODE | string Required when "AuthenticationReset Password Requires Auth Code" is enabled |
Responses
Request samples
- Payload
{- "email": "contact@simplejwtlogin.com",
- "code": "MY_SECRED_CODE_RECEIVED_BY_EMAIL",
- "new_password": "New user password",
- "JWT": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "AUTH_CODE": "MY_SUPER_SECRET_AUTH_CODE"
}
Response samples
- 200
- 400
{- "success": true,
- "message": "User password has been changed."
}
Authenticate to your WordPress website
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Authenticate user in order to obtain a valid JWT
string Required when username is not provided. | |
username | string Required when email is not provided. |
password | string User plain password. Required when pass_hash is not provided. |
password_hash | string User hashed password from Database. Required when password is not provided. |
AUTH_CODE | string Required when "Authentication Requires Auth Code" is enabled |
Responses
Request samples
- Payload
{- "email": "john@doe.com",
- "username": "myuser",
- "password": "string",
- "password_hash": "string",
- "AUTH_CODE": "MY_SUPER_SECRET_AUTH_CODE"
}
Response samples
- 200
- 400
{- "success": true,
- "data": {
- "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}
Refresh expired JWT
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Refresh expired JWT
JWT required | string Expired JWT. |
AUTH_CODE | string Required when "Authentication Requires Auth Code" is enabled |
Responses
Request samples
- Payload
{- "JWT": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "AUTH_CODE": "MY_SUPER_SECRET_AUTH_CODE"
}
Response samples
- 200
- 400
{- "success": true,
- "data": {
- "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}
Validate JWT
query Parameters
JWT required | string Example: JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c JWT |
AUTH_CODE | string Example: AUTH_CODE=MY_SUPER_SECRET_AUTH_CODE Required when "Authentication Requires Auth Code" is enabled |
Responses
Response samples
- 200
- 400
{- "success": true,
- "data": {
- "user": {
- "ID": "1",
- "user_login": "myusser",
- "user_nicename": "My User",
- "user_email": "myuser@simplejwtlogin.com",
- "user_registered": "2021-01-01 23:31:50",
- "user_activation_key": "test",
- "user_status": "0",
- "display_name": "myuser"
}, - "roles": {
- "0": "administrator"
}, - "jwt": {
- "0": {
- "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "header": {
- "typ": "JWT",
- "alg": "HS256"
}, - "payload": {
- "iat": 123123,
- "email": "myuser@simplejwtlogin.com",
- "id": 1,
- "username": "myuser"
}
}
}
}
}
Revoke JWT
Request Body schema: application/jsonapplication/jsonmultipart/form-dataapplication/x-www-form-urlencoded
Revoke JWT. When a JWT is revoked, it will be marked as invalid in future request.
JWT required | string Expired JWT. |
AUTH_CODE | string Required when "Authentication Requires Auth Code" is enabled |
Responses
Request samples
- Payload
{- "JWT": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
- "AUTH_CODE": "MY_SUPER_SECRET_AUTH_CODE"
}
Response samples
- 200
- 400
{- "success": true,
- "data": {
- "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}