hoauth2-providers-tutorial 0.8.0 → 0.9.0
raw patch · 2 files changed
+11/−11 lines, 2 filesdep ~hoauth2dep ~hoauth2-providersdep ~uri-bytestring
Dependency ranges changed: hoauth2, hoauth2-providers, uri-bytestring
Files
hoauth2-providers-tutorial.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hoauth2-providers-tutorial-version: 0.8.0+version: 0.9.0 synopsis: tutorial for hoauth2-providers module description: A tutorial that demostrates how to use hoauth2-providers package@@ -19,14 +19,14 @@ , base >=4.11 && <5 , bytestring >=0.9 && <0.13 , containers >=0.6 && <0.8- , hoauth2 >=2.9 && <2.15- , hoauth2-providers >=0.3 && <0.9+ , hoauth2 >=2.9 && <2.16+ , hoauth2-providers >=0.3 && <0.10 , http-conduit >=2.1 && <2.4 , http-types >=0.11 && <0.13 , scotty >=0.10.0 && <0.13 , text >=2.0 && <2.3 , transformers >=0.4 && <0.7- , uri-bytestring >=0.2.3 && <0.4+ , uri-bytestring >=0.4 && <0.5 hs-source-dirs: src default-language: Haskell2010
src/HOAuth2ProvidersTutorial.hs view
@@ -16,9 +16,9 @@ import Data.Text.Lazy qualified as TL import Network.HTTP.Conduit (newManager, tlsManagerSettings) import Network.HTTP.Types (status302)-import Network.OAuth.OAuth2 (+import Network.OAuth2 ( ExchangeToken (ExchangeToken),- OAuth2Token (accessToken),+ TokenResponse (accessToken), TokenResponseError, ) import Network.OAuth2.Experiment@@ -50,7 +50,7 @@ , acRedirectUri = [uri|http://localhost:9988/oauth2/callback|] , acName = "foo-auth0-app" , acAuthorizeRequestExtraParams = Map.empty- , acTokenRequestAuthenticationMethod = ClientSecretBasic+ , acClientAuthenticationMethod = ClientSecretBasic } pure IdpApplication {..} @@ -72,7 +72,7 @@ ] , acName = "foo-google-app" , acAuthorizeRequestExtraParams = Map.empty- , acTokenRequestAuthenticationMethod = ClientSecretBasic+ , acClientAuthenticationMethod = ClientSecretBasic } idp = Google.defaultGoogleIdp in IdpApplication {..}@@ -218,9 +218,9 @@ [Scotty.Param] -> Either TL.Text TL.Text paramValue key params =- if null val- then Left ("No value found for param: " <> key)- else Right (head val)+ case val of+ [] -> Left ("No value found for param: " <> key)+ (x : _) -> Right x where val = snd <$> filter (hasParam key) params hasParam :: TL.Text -> Scotty.Param -> Bool