Let's say I have a REST API and a frontend that is separate in AngularJS.
How do I use Oauth 2 to login this user without redirecting and asking to "authorize application" etc?
Basically what I want to do is:
- Display a login form where user enters username + password
- Send request to API to authenticate and if successful get a token
- Send user to the application view and use the token for all other API calls required until it expires
But in every Oauth 2 flow example I look at there is the redirect URL part with authorization of the application and send the user somewhere else. But my AngularJS app is the application itself.
I do not intend to use Google/Facebook or any other provider. The user database and the oauth server is hosted on the API itself.
So what is the proper flow in this scenario?