Skip to main content

Auto-login user into WordPress

GET 

/autologin

Validates the supplied JWT, resolves the matching WordPress user, and redirects the browser to the site (or to redirectUrl if provided and allowed by settings).

Requirements

  • Auto-login must be enabled in the plugin settings.
  • The JWT must be valid, not expired, and not revoked.
  • If "Auto-Login Requires Auth Code" is enabled, AUTH_KEY must be provided.
  • The calling IP must pass any IP allow-list configured in the plugin settings.

JWT delivery The JWT can be supplied via:

  • JWT query parameter (default)
  • JWT in request body
  • Authorization: Bearer <token> header (when enabled in plugin General Settings)
  • Cookie or session (when enabled in plugin General Settings)

A header, cookie, or session JWT is ignored on cross-site requests (Sec-Fetch-Site: cross-site, or an Origin / Referer naming another site) to prevent CSRF. Cross-origin browser apps must be listed in the CORS "Allow origin" setting; a * entry trusts the header JWT only, never the cookie or session JWT. Requests without these headers (mobile apps, servers) are not affected.

Success behaviour The response is an HTTP redirect (302) to the WordPress home URL or the custom redirectUrl. The browser session is authenticated as the resolved user.

Request​

Responses​

Login successful and the "Redirect after auto-login" setting is "No redirect." The body can be changed with the simple_jwt_login_no_redirect_message filter.