duosecurity / duo_universal_php

Duo OIDC-based two-factor authentication for PHP web applications
https://duo.com/docs/duoweb
BSD 3-Clause "New" or "Revised" License
21 stars 12 forks source link

invalid grant application error on reload #6

Closed nixaroo closed 1 year ago

nixaroo commented 1 year ago

Hello,

I've implemented an enrollment portal with Active Directory authentication based on the example provided by the SDK.

I've noticed that if one reloads the page when on the success page, the application will throw the following error:

invalid_grant: The provided authorization grant (e.g., authorization code) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.

I understand why it is happening but I'm not sure how to catch it in a graceful way which would redirect to the login page. Any ideas?

nixaroo commented 1 year ago

my bad I had a bit of code leftover from the example in the callback logic which was causing the error. It's all good now.