Since PKCE is now the recommended method of authorisation over the implicit flow, I'm looking for best practice on handling code verifier and recommendations on how this might be done. On high level PKCE Authorisation flow consist of:
- Generate
code_verifieron client side - Generate
code_challengefrom (1) - hit
/authorisewithcode_challengewhich redirect to select idp and in callback there's acode - use
codefrom (3) along withcode_verifierto exchange for access token
Question is, in step 3, before the application redirect to authorisation server and then the idp, one has to store the code_verifier somewhere. Where is that somewhere?
Seems like libraries like okta-oidc-js store the code_verifier in sessionStorage. Doesn't that expose you to XSS attack? i.e. if I was store the code_verifier in sessionStorage before the application goes into the Authorisation flow and redirects, on the callback, what stops some rouge extension from reading the code from the URL and code_verifier from sessionStorage? Combination of which can be used to exchange for a access token.