Monday, 18 February 2019

Handling Social Media Integrations in a MEAN stack App after a user is Logged in

A user can create an account in my App only with his work email.

Example: john@xyzcompany.com

After he creates an account, he can link multiple social media accounts to his profile.

Example: john@gmail.com, john2@gmail.com

I'm using MEAN stack to develop the App.

When a user logs in to my app, I'm creating a JWT token to authorize all his future requests to the server.

When it comes to Social Media accounts Integrations, After successful authentication I'm able to receive the accessTokens from these Social Media to the backend callback URL. I need to link the tokens to the right user. Is there anyway I can pass my JWT token along with the callback URL to identify which user has made the request, because I cannot identify the user based on the email in his Social Media Account?

I was able to solve this using socket.io. But I feel it is unnecessary to use sockets for simple authentication.

Is there any other approach to solve it? I have researched online, few of them suggested using passport. I don't fully understand how passport works, I just feel it is just a middleware to authenticate API requests from users, which I'm doing anyway using a custom function.

Could someone explain whether it is possible to pass JWT in callback URLs using passport strategies?

What is the right approach to handle such authentications in a MEAN stack app? I'm stuck with this issue since the past week, really looking forward for a good solution.



from Handling Social Media Integrations in a MEAN stack App after a user is Logged in

No comments:

Post a Comment