I am currently creating a web application that is an AngularJS interface that interacts with a RESTful API created using Laravel. I'm making good progress, but it's hard for me to figure out how to handle user authentication.
I was told that I should use OAuth for authentication, and I decided to use it, as it could be a learning experience for me. The package I use for processing is oauth2-server-laravel .
The main history of users is that users can register their combination of username and password for the application, and then they register in the application with the same username and password. They are authenticated only by username and password, and not by any client secrecy. After entering the system, they should be given an access token, which will be sent along with each future request for authentication at different API endpoints.
The OAuth2 library has a grant type of “password stream” that I seem to need, but it also accepts client_id and client_secret parameters that I don’t need. The request URI looks something like this:
POST https://www.example.com/oauth/access_token? grant_type=password& client_id=the_client_id& client_secret=the_client_secret& username=the_username& password=the_password& scope=scope1,scope2& state=123456789
But I just want to:
POST https://www.example.com/oauth/access_token? grant_type=password& username=the_username& password=the_password
How can I provide a client id and secret for a user who is not yet authenticated?
Is there any other grant I can use, or is this what I want to achieve that is simply not suitable for OAuth?
angularjs authentication php oauth laravel
John dorean
source share