Back

How to implement facebook login on mobile with jwt


I am trying to make a api for mobile and I ma using jwt based authentication. using tymon/jwt-auth package.

Now my mobile app only uses facebook login, which will be handled by the mobile.

so then how should I implement the login server side?

What will mobile app have to do to get the token form server and what the workflow should look like on server?

I was discussing with my android developer he was suggesting that he will send email and facebook access token. Then I will use this token to fetch the user details from facebook with the given token and get the email from facebook and match it with the email given at the end point. If both matches I will give a jwt token in response for mobile app to use.

I want to know from other users how they deal with this or what is the right way of doing this.

pimplesushant replied 5 months ago

$user = User::where('email','=',Input::get('email'))->where('fb_token','=',Input::get('fb_id'))->first();

//then use $token = JWTAuth::fromUser($user);


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us