WordPress.org

Ready to get started?Download WordPress

Forums

external authentication single sign-on (1 post)

  1. drincruz
    Member
    Posted 11 months ago #

    hey, hopefully someone can give me some insight. i have an external authentication service that will be used instead of wordpress. i am basically using the following code snippet:

    wp_set_current_user($user->ID, $user->user_login);
    wp_set_auth_cookie($user->ID);
    do_action('wp_login', $user->user_login);

    it works, but only if i've logged into wordpress at least once. so for example, if i log into wordpress the usual way, logout, and then authenticate through my external service and then try navigating to wordpress, it will automatically log me in and redirect me to the wordpress admin page.

    ideally i would like to have the user automatically redirected to the wordpress admin page if the user is logged into the external service. otherwise, then show the wordpress login page.

    it sounds cookie-related. thoughts anyone?

    thanks. cheers!

Reply

You must log in to post.

About this Topic