Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Login With WP JWT Auth

We are using WP JWT Auth plugin to login user to WordPress from wp rest API. WP JWT Auth plugin requires a password to get the token, now when we are integrating facebook login, I am not sure how to get the user logged in since we won't be having passwords from facebook.

Any suggestions?

like image 533
Zain Sohail Avatar asked Jul 10 '18 22:07

Zain Sohail


People also ask

Does Facebook use JWT for authentication?

It provides an entry point: “/auth/facebook” that redirects to FBs and proceeds to the authentication. After that it acquires the AccessToken for the logged user and creates a JWT Token that returns to the client.

What is JWT token flutter?

JWT Decoder This is a small library for decoding a json web token for dart / flutter. Since the header and payload is base64 encoded you can easily know the stored data with no password, you can also know if the token is expired or not.


1 Answers

Yesterday I opened a bounty for your question and today I'm answering it!

You will need two WordPress plugins: stionic users and nextend social login (you need to configure it on order for stionic to work. Watch the video on that page in order to know how to configure it)

When done you could send a post request to https://example.com/wp-json/wp/v2/m_facebook/loginin postman and you will notice that you will get the same token that you get when logging in https://example.com/wp-json/jwt-auth/v1/token

After that, you can configure facebook ionic plugin and you are done.

JSON API User plugin is an alternative but I haven't tried it

Useful tutorials

Facebook ionic login - Wordpress ionic login

like image 185
Lynob Avatar answered Oct 07 '22 09:10

Lynob