REST API social Login in cakephp - angularjs

i am a newbie to Cakephp 3.*, I was playing around with cakephp REST API and angularjs. So far i was able to successfully integrate the registeration and login using the ADmad/JwtAuth (Link). I want to add social login as well (My application is a stateless, as all the back-end related queries are in the REST API)how can i do this?
Please Help.
Thanks

Related

Django Rest Framework user auth with React

Can anybody tell me the updated way to use User Authentication for Django Rest Framework?
Each tutorial seems outdated.
I would like to sign up, login logout using React with fetch function.
Please share your experience.

Implementation of Spring security in AngularJS

I am new to Spring security. I want to implement it in my AngularJS app. After authentication it must redirect to a page based on roles, like if is it admin it must redirect to admin.html and if it is user it must redirect to user.html.
Going through Spring security documentation can be of great help.
If you want to be more familiar with some working project model. This site offers some great working project.
This project will give you an easier understanding of ROLE based authentication.
I have also done a simple project for my office internship. if it is any help to you, heres the link.

AngularJs + JWT + WCF or WebAPI

I have a small angular js application where I am using angular js, typescript & html 5 for my UI. I have currently wired up the UI to get data via Restful WCF service (c#). All here works fine. Now I am looking to implement security/authentication in my application where I would like to have login/logout/register page. I have read about JWT and looks like a good one. Is this the standard nowdays of using JWT or if there are others options available.
If JWT is a good option for my site (pubic website), could anyone provide inputs where I can start with. I could not find much helpful basic posts that would guide how to create a simple form in angular and hit wcf/web api sercvice.
Any inputs would be appreciated.
I have had a good experience with the open-source IdentityServer3 project. They support JWT authentication from client to Web API. I myself have used it both as an authentication server providing tokens and as a middle-ware in the Web API for authorizing different controllers.
Here's a link to their documentation.

CakePHP 3: Form and Digest Auth in one App

I'm currently developing an application in CakePHP 3, this application contains a Web Front End and a plugin for API/WebServices that serves mobile apps.
The web front end login system rely on FORM Based Authentication and work perfectly, but i want to uses a Digest Based Auth to check user credentials on API Request.
The API request is a plugin on the same system made for me, and router via /api/users (example) endpoints to server mobile apps.
I trying to get the 2 ways of authentication with no luck and also try the JWT plugin with no luck.
Anybody has a solution to this or have a similar problem?
Thank you folks!
after further investigation, the problem is all about CORS
CORS Enabling
In Cake create a new beforeFilter with the following code:
$this->Security->csrfCheck = false;
And that's all.
Thanks folks!

Oauth social login using MEAN.js Restful sessionless API backend

I'm developing a Restful API using MEAN.js, which will be consumed by an AngularJS Web site and Phonegap Mobile Apps.
I'd like the user to be able to create an account and/or login using Faceboo, Google and Twitter.
I'm trying to use the same sample code that comes with MEAN.js seed application, but with the Node side of it, on port 3000 serving only the API, and the web site running on another server (currently on port 9000).
I','ve already implemented Token authentication using a Passport custom Local strategy, which generates a token, and the Bearer Strategy to autheticate API calls.
But I'm having problems with social login, to link social accounts to existing users.
From the Angular Client I call an api endpoint that redirects the user to the oauth provider (e.g. Twitter). When the user comes back, my serve has no knowledge of the logged user, since I'm not using sessions anymore.
I've tried to return the provider token to the client, but have problems parsing the anguler url. Then I coded another page outside angular that receives the provider token and calls an api endpoint sending the oauth token and the token issued by my api. It worked for Google, but not for Twitter. It seems twitter needs a session.
Anyway, what is the best approach to achieve what I want? How can I make this work?
Since your using Angularjs, take a look at this Angularjs library https://github.com/sahat/satellizer. The library pretty much opens up an oauth popup and checks the popup url for tokens. You can easily replicate the approach or just use this library. It works with a few social media providers like Twitter and its easy to add more.
I was in need of the same thing and so I set out to create my own. It's still in development but should give you a good start. Feel free to create a pull request and help to make it better. Maybe we can eventually merge it into their codebase.
https://github.com/elliottross23/MeanJsSocialLoginTokenAuth

Resources