How to login same user in wordpress when login in laravel?
-
I have a main website programmed with laravel and the blog of this website in a subdomain and made with wordpress , i have already shareed user register between them , so when new user register on main laravel site , it will be created automatically on wp site . the issue now is sharing login i want if a user logged in main site to be logged also in blog wp ?
i have tried with api , but it doesnot work ?
in laravel login function
//login user in WP help website Http::post('https://subdomain/wp-json/userapi/v1/userLogin', [ 'email' => auth()->user()->email, ]);
in functions.php in wordpress
public function userLogin (WP_REST_Request $request){ $email = $request->get_param('email'); $user = get_user_by('email', $email); wp_set_auth_cookie($user->ID); do_action( 'wp_login', $user->user_login, $user ); }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to login same user in wordpress when login in laravel?’ is closed to new replies.