When integrating Drupal with Azure AD B2C using the miniOrange OAuth Client module, you may encounter a “Redirect URI mismatch” error. This typically occurs when the URI sent from Drupal does not match the URI registered in Entra ID / Azure AD B2C.
Symptoms:
- Users cannot log in via EntraID / Azure AD B2C.
- Error message: “The redirect URI does not match the registered URI for this application.”
- The module may still reference a development or old site URL.
Step 1: Verify Callback/Redirect URI in Drupal
- Navigate to your Drupal site:
Drupal Admin → miniOrange OAuth Client Module → Configure OAuth tab
- Locate the Callback/Redirect URI field.
- Copy the URI for use in Azure AD B2C.
Step 3: Clear Drupal Cache
After updating Azure AD B2C:
- Clear the Drupal cache to apply the new settings.
- Configuration → Performance → Clear all caches
- Configuration → Performance → Clear all caches
- Test the OAuth login flow again.
Step 4: Troubleshooting & Best Practices
- Ensure the URI in Drupal exactly matches the Azure AD B2C entry.
- Avoid extra spaces, trailing slashes, or mismatched case.
- If using multiple environments (dev, staging, prod), register all necessary URIs in Entra ID / Azure AD B2C
- Clear browser cache or try using an incognito window if issues persist.