Support » Plugin: WP OAuth Server (OAuth Authentication) » Bad Redirect After Login

  • Hi. First, thanks for a great plugin! Second, I’ve been running into an issue with the redirect after the user logs into WordPress. WordPress lives at, so I’ve configured my OAuth2 client (the oauth2 Ruby gem) in the following way:

    authorize_url: /blog/oauth/authorize

    When I access the generated authorization url, it reaches the plugin, which redirects to the WordPress login form just fine. However, the path of the URL that is given to the form by your plugin is The doubled up “blog” causes a 404 when I submit the form.

    The line that seems to be the source of the trouble is this one from class-wo-api.php:

    wp_redirect( wp_login_url( site_url( $_SERVER[‘REQUEST_URI’] ) ) );

    The site URL configured by WordPress is The authorize URL is /blog/oauth/authorize. These get concatenated together by site_url. I’ve worked around the issue by just removing the site_url call.

    Do the developers have any better suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Justin Greer


    Forum Moderator

    Thank you for pointing this out. I will be sure to send this to the project manager to put on the list to discuss in our next meeting.

    The issue seems to be what you suggested but this is only happening for your type of setup. We may be able to use home_url() instead. We will run tests and update as needed.

    Justin Greer



    This issue still persist, changing plugins core files is not a way to solve this.
    How do i resolve this issue?

    WP OAuth Server Build 3.6.0
    Wordpress version 4.9.8

    Hi Team,

    We have the same problem.

    We are working with the WordPress core in a separated folder /wp.

    So everything works but it redirect us to and not to

    Main site =>
    WP OAuth Server Build 3.7.0
    Wordpress version 4.9.9

    Sub site =>
    OAuth 2.0 Single Sign On 1.3.2
    Wordpress version 4.9.9

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bad Redirect After Login’ is closed to new replies.