Wordpress & Social Logins

Hi - I’m a total coding hobbyist here and just getting started with Auth0. Have searched all over forum so maybe I’m just in the wrong place or too new to know better.

We are wanting to use Auth0 to have clients go to specific wordpress pages/posts but to gain access use the Auth0 social login feature. We are not trying to use Auth0 to have people login to the back end of our wordpress site. Just want to market certain page/pages within our domain (www.mydomain.com/private page) and have people required to use social login to gain access. Is this possible?

@kalvik - This is more of a WordPress question than an Auth0 one. Auth0 will handle authenticating users, blocking off content will need to be done in your theme or plugin. You can use the same functions and links as you usually would.

Your best bet is to redirect to the login page in a template_redirect hook with a pointer back to the current page:

if ( ! is_user_logged_in() ) {
    // Sends the visitor to wp-login.php with a redirect back to the current page

Or you could do it in the template like this:

if ( is_user_logged_in() ) {
    // show the content
} else {
    // Show the Auth0 login form, redirect back to the current page
    echo do_shortcode( '[auth0]' );
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.