I am currently trying to implement a web service (API) with OAuth2 authentication using Spring Security OAuth. As far as I understood, given a user, a client app and a server, the authentication process is as follows:
- User requests resource from server via client
- Client retrieves request token from server
- Server responds with a temporary request token and a redirect URL
- Client loads web page (redirect URL) and lets user enter credentials in order to authenticate the request token. The form inputs are sent to the server, input is unknown to client.
- Server replies with an authorization code, which is handed to the client
- Client uses authorization code to retrieve an access token (and, optionally, a refresh token if one was requested)
- User hands access token to client
- Client uses access token to retrieve requested resource
In Spring OAuth, there are three grant types to request an access token:
Authorization Code, which is the method I described above, refresh token, and user credentials. I don't know how retrieval by user credentials works, is it similar to retrieval via refresh token?