Title: Redirect URL errors
Last modified: May 28, 2020

---

# Redirect URL errors

 *  [kaa4ever](https://wordpress.org/support/users/kaa4ever/)
 * (@kaa4ever)
 * [6 years ago](https://wordpress.org/support/topic/redirect-url-errors/)
 * Hi
 * First off, thanks for the plugin, it’s useful, although it seems there are some
   minor issues regarding the redirect URL.
 * I the plugin settings page, is says “_Setup Azure Active Directory and ensure
   you set the redirect URL to [https://example.com/azure-oauth/callback](https://example.com/azure-oauth/callback)_“,
   however the actual redirect url set in the request to microsoft is “_&redirect\
   _uri=https://example.com/azure-auth/callback_” – note the difference between **
   oauth** and **auth**.
 * This will result in an error at Microsoft complaining that “_AADSTS50011: The
   reply URL specified in the request does not match the reply URLs configured for
   the application: ‘cf79f640-0986-4e72-87d9-dc1cd383c4e9’._”
 * The easy fix is to just set the redirect url in the Azure AD settings to “_[https://example.com/azure-auth/callback](https://example.com/azure-auth/callback)_“,
   and you’ll get past the error at Microsoft, only to bump into a 404 error at 
   your site, because the redirect url “[https://example.com/azure-auth/callback?code=](https://example.com/azure-auth/callback?code=)..”
   doesn’t exist.
 * So, instead of changing the redirect URL, I’ve tried to debug the plugin and 
   changed `site_url( '/azure-auth/callback' )` to `site_url( '/azure-oauth/callback')`
   at two places in `callback.php`. Unfortunately this doesn’t change anything, 
   you still end up at a 404 page. Doing more debugging, it seems this plugins listens
   to all routes with a query param of `azure-auth`, hence the paths `/azure-oauth/
   callback` and `/azure-auth/callback` with query params will never work?
 * Changing the `site_url`s to `site_url( '?azure-auth=callback' )`, and updating
   the redirect url at Azure AD accordingly, does however make the module work.
 * Is this a bug in the plugin, or am I doing something different?
 * While we are at it, in `callback.php`, it expects `$user_info->email` to exists–
   in my case it doesn’t, but it exists at either `$user_info->unique_name` or `
   $user_info->upn`. It would be very nice if the plugin would take that into consideration
   when trying to authenticate.

The topic ‘Redirect URL errors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/sso-with-azure-ad.svg)
 * [SSO with Azure AD](https://wordpress.org/plugins/sso-with-azure-ad/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sso-with-azure-ad/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sso-with-azure-ad/)
 * [Active Topics](https://wordpress.org/support/plugin/sso-with-azure-ad/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sso-with-azure-ad/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sso-with-azure-ad/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [kaa4ever](https://wordpress.org/support/users/kaa4ever/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/redirect-url-errors/)
 * Status: not resolved