mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-30 06:34:53 +02:00
use alternative in oauth2RedirectUri
This commit is contained in:
parent
79a955edd0
commit
87dc101b47
@ -13,6 +13,7 @@ module Yesod.Auth.OAuth2.Dispatch
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (unless)
|
import Control.Monad (unless)
|
||||||
|
import Control.Applicative ((<|>))
|
||||||
import Control.Monad.Except (MonadError (..))
|
import Control.Monad.Except (MonadError (..))
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
@ -109,7 +110,7 @@ withCallbackAndState name oauth2 csrf = do
|
|||||||
callback <- maybe (throwError $ InvalidCallbackUri uri) pure $ fromText uri
|
callback <- maybe (throwError $ InvalidCallbackUri uri) pure $ fromText uri
|
||||||
pure
|
pure
|
||||||
oauth2
|
oauth2
|
||||||
{ oauth2RedirectUri = Just callback
|
{ oauth2RedirectUri = (oauth2RedirectUri oauth2) <|> Just callback
|
||||||
, oauth2AuthorizeEndpoint =
|
, oauth2AuthorizeEndpoint =
|
||||||
oauth2AuthorizeEndpoint oauth2 `withQuery` [("state", encodeUtf8 csrf)]
|
oauth2AuthorizeEndpoint oauth2 `withQuery` [("state", encodeUtf8 csrf)]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user