Skip to main content

Connecting WordPress with OpenID Connect

Let people sign in to a WordPress website with their ID Everywhere account, including two-factor authentication. This guide uses the free OpenID Connect Generic Client plugin and links ID Everywhere to the WordPress accounts you already have, by email address.

Before you start

  • You need to be an administrator on the WordPress site and a Domain Admin in ID Everywhere.
  • Each person who will sign in needs an ID Everywhere account in your company, with the same email address as their WordPress account (users must already be created in WordPress with the same email).
  • Keep a WordPress administrator browser window signed in while you set this up, so you can't lock yourself out.

1. Install the plugin

  1. In WordPress, go to Plugins › Add New Plugin.
  2. Search for OpenID Connect Generic Client, then click Install Now and Activate.
  3. Go to Settings › OpenID Connect Client. Scroll to the bottom and copy the Redirect URI. It looks like this:
    https://yourwebsite.com/wp-admin/admin-ajax.php?action=openid-connect-authorize

2. Register WordPress in ID Everywhere

  1. In ID Everywhere, go to Sign-In › OIDC Apps and click + Add OIDC Application.
  2. Application Name: your website's name, for example "Company Website". People see it on the sign-in screen and in their sign-in emails.
  3. Client Type: Confidential. WordPress runs on a server, so it can keep a secret.
  4. Authorized Redirect / Callback URLs: paste the Redirect URI from step 1, exactly as WordPress shows it, including the ?action=openid-connect-authorize part.
  5. Scopes: leave openid, profile and email ticked. WordPress needs the email address to find each person's account.
  6. Click Create Application, then copy the Client ID and the Client Secret. The secret is shown only once.

Paste the client secret straight into WordPress or a password manager. Don't email it. If it's lost, or you're not sure it was pasted exactly, click Regenerate Client Secret and use the new one.

3. Configure the plugin

Back in WordPress, on Settings › OpenID Connect Client, enter these settings:

Setting Value
Login Type OpenID Connect button on login form (recommended to start; see Login Type)
Client ID From step 2
Client Secret Key From step 2
OpenID Scope openid email profile
Login Endpoint URL https://app.ideverywhere.com/oauth2/authorize
Userinfo Endpoint URL https://app.ideverywhere.com/oauth2/userinfo
Token Validation Endpoint URL https://app.ideverywhere.com/oauth2/token
End Session Endpoint URL Leave blank
JWKS URI https://app.ideverywhere.com/.well-known/jwks.json (lets WordPress check that each sign-in really came from ID Everywhere; shown in newer versions of the plugin)
Issuer

https://app.ideverywhere.com

JWKS Cache TTL (seconds)

3600

ACR values

Leave blank

Identity Key

email

HTTP Request Timeout

5

Disable SSL Verify Unticked
Nickname Key given_name
Email Formatting {email}
Display Name Formatting {given_name} {family_name}
Identify with User Name Unchecked 
Enable Refresh Token Unchecked (ID Everywhere doesn't issue refresh tokens)
Link Existing Users Checked
Create user if does not exist Unchecked (see below)
Redirect Back to Origin Page Suggest Checked but your choice. Checked will return them back to the wordpress login page if their access token has expired

Click Save Changes.

Don't use preferred_username for the Identity Key or Nickname Key. Some providers send it, but ID Everywhere doesn't, and WordPress will refuse the sign-in.

How WordPress matches people to their accounts

With the settings above, WordPress uses the email address from ID Everywhere to find the right account:

  1. The first time someone signs in with ID Everywhere, WordPress looks for an existing account with the same email address.
  2. If it finds one, it signs them in to that account and links the two. They keep their WordPress role, posts and settings, and their WordPress password still works too.
  3. After that, they're signed in to the linked account every time.
Situation What happens
WordPress account with the same email Signed in to that account
No WordPress account with that email Sign-in is refused, because Create user if does not exist is off.
Different email in WordPress and ID Everywhere Treated as no account. Update the email in WordPress (Users › Edit) or in ID Everywhere so they match
Person disabled in ID Everywhere Can no longer sign in with ID Everywhere. If they also know their WordPress password, remove or disable their WordPress account too

Leave "Create user if does not exist" off unless you want everyone in your company to get a WordPress account automatically. If you turn it on, new accounts get WordPress's default role (Settings › General › New User Default Role (default is Subscriber)). Make sure that's Subscriber, never Administrator.

Only people in the company that owns the OIDC app can sign in to it. If you're an MSP setting this up for a client, create the app while you're working in that client's company.

Login Type: button or automatic

  • OpenID Connect button on login form: the normal WordPress login page shows a Login with ID Everywhere button, and the username and password fields stay available. Start with this, so you can still sign in with a WordPress password while you test.
  • Auto Login - SSO: visiting the login page sends people straight to ID Everywhere. Switch to this only after ID Everywhere sign-in is working for every administrator.

To put the sign-in button somewhere else, such as a members page, add the shortcode [openid_connect_generic_login_button].

4. Test it

  1. Open a private browser window and go to your WordPress login page, for example https://yourwebsite.com/wp-login.php.
  2. Click Login with OpenID Connect.
  3. Sign in with your ID Everywhere email, password and two-factor code. If you're already signed in to ID Everywhere, this step is skipped.
  4. You land in WordPress, signed in to your existing account.

The person signing in gets a New App Sign-In email naming your website. They get one the first time they use it during each ID Everywhere session.

Troubleshooting

Turn on Enable Logging in the plugin settings to see each step. In ID Everywhere, check the Audit Log for oidc. events at the same time.

Error Cause and fix
invalid_client The Client ID or Client Secret in WordPress doesn't match. Paste them again; if unsure, regenerate the secret.
Redirect URI error on the ID Everywhere screen The Redirect URI registered in ID Everywhere doesn't exactly match the one in the plugin. Copy it again from the bottom of the plugin's settings page.
"User is not authorized for this application" The person belongs to a different company from the one that owns the OIDC app.
WordPress says the user is invalid, or the user claim is missing The Identity Key isn't email, or the email scope isn't ticked on the app in ID Everywhere.
Sign-in works but goes to the wrong account, or a new one Identify with User Name is ticked. Untick it so accounts are matched by email.
"Failed user creation" or no account found There's no WordPress account with that email. Create one in Users › Add New with the same email, then sign in again.

For other errors, see Troubleshooting OIDC Connections.