I'm looking for a good process of authentication in a SPA.
I think that the process what dewastator describes in this question seems good but the process of the article what thierry templier presentes in his answer seems more complex as it uses 'mac_key', 'refresh_token' and so on.
Is it not enough just to use login ID, password and access token for authentication? I'm not thinking to make APIs enable cross origin requests
1 Answer
Yes, you can simply exchange username & password for an access token. This is the Resource Owner Password Credentials Grant. This really is the simplest way to secure a Single Page App (SPA).
I recommend using JWT for the token format and HTTPS-Only cookies as the secure storage mechanism. I've covered these topics in my recent blog article, Token Based Authentication for Single Page Apps
Disclaimer: I work at Stormpath. We've been doing a lot of work with SPAs, and we have a full-stack javascript solution for token authentication in our Stormpath Angular SDK