I'm building an API with a static frontend, and getting tripped-up by auth. I'm considering using Auth0 for some of this, but I'm a little foggy on what happens after authentication.
The SPA and API are on separate hosts.
So, is this close to the sequence of events for successful API access?
- A client requests a resource from an API
- The API responds that the resource is protected
- The client submits login credentials to Auth0
- Auth0 authenticates the credentials, and responds with... what? A token?
- The client stores this token for future use? (isn't this a recipe for CSRF?)
- The client then requests the resource from the API, but this time with the token?
- The API recognizes the token, and responds with the resource? Or, does the API have to validate the token against Auth0, for every request, before responding with the resource to the client?
Thanks in advance.