Standard web application. Frontend+Backend(Golang). Frontend uses backend API
Regular Web Application type in auth0 dashboard. Using authorization code flow.
I am implementing this scenario:
- The user goes to the personal account url(aka /login). The backend understands that it does not have a cookie and redirects to AuthURL auth0. The user sign up(sign in) through the login page (passed the authorization code flow). The resulting opaque access token backend save in a cookie. And also i save refresh token for this access token in database.
Next, all API requests from the frontend are sent with the received opaque access token in cookie. - For each API request from the frontend like this, backend do this: validate the access token(signature) from the cookie ā see if it is expired ā if it is expired, then refresh it using refresh token. And set new access token in cookie. P.S. Refresh token rotation is on of course.
In this scenario I encountered 2 problems
- How to get a valid jwt access token(not opaque) whose signature I could then check. To get a valid jwt access token you need to use the API (not application) to be able to pass the āaudienceā, but for the API I can no longer use Regular web application type and authorization code flow, I get the error āGrant type āauthorization_codeā not allowed for the clientā. I can only use Mashine To Mashine application type and client credential flow.
- How to change the lifetime of an access token. By default it is 24 hours, which is quite a long time. And again, I can change the lifetime of the access token only if I use the API, encountering all the same consequences as in point 1
As a result, it turns out that if I use authorization code flow, then I cannot:
- I can`t check the received access token(opaque) for signature
- I canāt configure the access token lifetime
Could you please tell me if I understand everything correctly?