Background
I'm building an spa and mobile app that will communicate with a rest api. I'd like to run a separate auth server to manage users (resource owners) and think the oAuth2 4.3 Resource Owner Password Credentials grant makes sense for my application.
As described in the specification, the user (resource owner) is supposed to communicate directly with my rest api (client), and my rest api (client) is then supposed to communicate with the auth server.
+----------+
| Resource |
| Owner |
| |
+----------+
v
| Resource Owner
(A) Password Credentials
|
v
+---------+ +---------------+
| |>--(B)---- Resource Owner ------->| |
| | Password Credentials | Authorization |
| Client | | Server |
| |<--(C)---- Access Token ---------<| |
| | (w/ Optional Refresh Token) | |
+---------+ +---------------+
Figure 5: Resource Owner Password Credentials Flow
However, I'd like to change that flow. I'd prefer that the user (resource owner) communicate directly with the auth server, receive tokens, and then use those tokens to communicate with my rest api (client):
+----------+
| Resource |
| Owner |
| |
+----------+
v
Resource Owner |
Password Credentials (A)
|
v
+-----------+
------------(G)-------- JSON -------------->| SPA / APP |
| -----(D)---- Access Token ----------<| |
| | +-----------+
| | v ^
| | Resource Owner | |
| | Password Credentials (B) (C) Access token
| | | |
^ V v ^
+---------+ +---------------+
| |>--(E)--- Token Introspection --->| |
| | | Authorization |
| REST | | Server |
| API |<--(F)----- Token Metadata ------<| |
| | | |
+---------+ +---------------+
Figure 5: Resource Owner Password Credentials Flow (modified)
FYI Steps (E) and (F) are as defined in RFC 7662.
Questions
I'm wondering what your thoughts are on this design. I know it's a bastardization of RFC 6749 but I think it's better suited for my needs.
- Is there a better flow as defined in RFC 6749 that would meet my needs?
- Is there another specification, other that RFC 6749, that would better suite my needs?
I think the pros of my flow are:
- Doesn't require me to store passwords in the spa or mobile app
- Allows my users to communicate directly with the auth server for login / logout, etc. completely separating the concern from my rest api(s)
- Allows me to more easily add other rest api's (micro-services) without having to deal with user auth.
I think the cons are:
- Requires my auth server to be public facing
- Requires a few more steps
- Doesn't conform to the spec, perfectly