Check for ErrorResponse before CSRF

It's possible there's an error that explains why the state token isn't
as expected. It should be fine to report those details before verifying
CSRF.
This commit is contained in:
patrick brisbin 2021-02-26 14:44:10 -05:00
parent ab17f214eb
commit b71ae8f60d

View File

@ -81,8 +81,8 @@ dispatchCallback
-> FetchCreds site
-> m TypedContent
dispatchCallback name oauth2 getToken getCreds = do
csrf <- verifySessionCSRF $ tokenSessionKey name
onErrorResponse $ throwError . OAuth2HandshakeError
csrf <- verifySessionCSRF $ tokenSessionKey name
code <- requireGetParam "code"
manager <- authHttpManager
oauth2' <- withCallbackAndState name oauth2 csrf