I am building an Angular (version 5) app that only talks to one backend, my API (flask application on a web server), which in turn talks to my database. The application is for data entry and visualization, where data is constantly loaded and saved to/from the backend. I have control over all three parts.
I am thinking of using Auth0 to handle the auth/user management.
My question is, can I treat this application as a 'regular' web app and use Authentication Code Grants, instead of implicit grants as is usually recommended for SPA's? That is:
- The SPA would get an Authorization Code from auth0 through a /login endpoint redirecting to the appropriate auth0 page
- Authorization Code is passed to the API through some endpoint (probably the /callback endpoint).
- API talks to Auth0 to exchange exchanges AC for a token.
- Token is passed to database with every request, and rejects if token is not valid (Token validity checking is possible in-database with postgresql)
- The association between the token on the API server and the user is done through encrypted cookies (Flask's 'session' variable)
Reading through the a lot of the discussion around Implicit Grants vs Authentication Code Grants, it seems the main difference is that in a true SPA application, there is no single server controlled by the Resource Provider which could store the Client Secret or token. But, with my situation, can't I just think of the SPA application as a traditional (ajax-heavy) web page?
I found this post in the auth0 forums which hints that this may be " brittle because in practice you have an OAuth2 flow being handled by what should be two independent components," but I do not understand how independence between the components should make any difference.