What you are creating
Microsoft requires every website that offers “Sign in with Microsoft” to be registered in the Microsoft Azure portal. That registration gives you two pieces of text — an Application (client) ID and a Client Secret — which you paste into the WordPress admin. The website handles everything else.
- You become the owner of the sign-in app (your organisation, your control).
- Visitors can use any Microsoft account — personal (@outlook.com, @hotmail.com, @gmail-linked) or work/school.
- The website only receives the person’s name and email address. Nothing else, no access to their mailbox or files.
Sign in to the Azure portal
Open the portal and sign in with any Microsoft account:
https://portal.azure.comOpen “App registrations” and start a new app
- In the search bar at the top of the portal, type
App registrationsand open it. - Click + New registration (near the top).
Fill in the registration form most important step
- Name: anything you like, e.g.
PharmaGrade Peptides Sign-In. - Supported account types: select the third option — “Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox)”. This is what lets both personal and work accounts sign in.
- Redirect URI (optional): set the first dropdown to Web and paste the Authorized redirect URI exactly as it appears in the WordPress admin under Settings → PharmaGrade Access → Sign-In Providers → Microsoft.
- Click Register.
The redirect URI currently shown on the development site is:
http://localhost:10399/http/https, same domain, same port, and the trailing slash. Microsoft rejects the sign-in if even one
character differs. When the site moves to its live domain, add the live address the same way (see the last section).Copy the Application (client) ID
Right after registering, Azure shows the app’s Overview page. Find the field
“Application (client) ID” and copy its value (a long code like
00001111-aaaa-2222-bbbb-3333cccc4444). Keep it for step 6.
Create the Client Secret
- In the left menu of your new app, click Certificates & secrets.
- On the Client secrets tab, click + New client secret.
- Description: e.g.
PharmaGrade sign-in. Expires: choose 24 months (the longest option). - Click Add. A new row appears with two columns: Value and Secret ID.
Keep both pieces of text for the next step. Treat the secret like a password — share it only through a secure channel.
Paste the credentials into WordPress
- In the WordPress admin, go to Settings → PharmaGrade Access.
- Open the Sign-In Providers card → Microsoft tab.
- Paste the Application (client) ID into “Application (client) ID”.
- Paste the secret Value into “Client Secret (value)”.
- Leave “Directory (tenant) ID” as
common. - Click Save Settings.
The status line flips to “Microsoft sign-in is active” and the button appears on the login form automatically.
Test it
- Open the site’s login page (sign out first, or use a private/incognito window).
- Click Continue with Microsoft.
- The first time, Microsoft shows a short consent screen (“You are signing in to …”) — click Accept/Yes.
- You land back on the website, signed in. An account is created automatically with your Microsoft email if one does not exist yet.
When the website goes live
One app registration serves both development and production. After launch, add the live site’s address to the
same app: open your app in Azure → Authentication → Add URI (platform Web) → paste the
Authorized redirect URI shown on the live site’s settings page (it will look like
https://your-domain.com/) → Save. Nothing else changes in WordPress.
Keeping it working
Client secrets expire (24 months at most). About a month before expiry, create a new secret (step 5), update the value in WordPress, and delete the old one. Microsoft also sends reminder emails to the account that owns the registration.
If something does not work
| What you see | What it means and the fix |
|---|---|
| “redirect… does not match” (AADSTS50011) | The Redirect URI registered in Azure differs from the one in the WordPress settings — check the trailing slash, http vs https, and the port. Re-copy it from the settings page. |
| Sign-in fails immediately, “invalid client” | The secret is wrong — most often the Secret ID was pasted instead of the Value, or the secret was deleted. Create a fresh secret and paste the Value. |
| Button still says “needs setup” | Both fields (ID and Secret) must be filled in and saved for the button to switch on. |
| A work/school user sees “Need administrator approval” | Some companies require their IT admin to approve external sign-in apps once. Personal Microsoft accounts are not affected. |