hoauth2-tutorial 0.1 → 0.1.1
raw patch · 2 files changed
+8/−6 lines, 2 files
Files
- hoauth2-tutorial.cabal +1/−1
- src/HOAuth2Tutorial.hs +7/−5
hoauth2-tutorial.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hoauth2-tutorial-version: 0.1+version: 0.1.1 synopsis: Tutorial for using hoauth2 description: Tutorial to demostrate how to use hoauth2 to implement OAuth2 flow in an web Application.
src/HOAuth2Tutorial.hs view
@@ -27,8 +27,9 @@ -- -- OAuth2 starts with [authorization](https://www.rfc-editor.org/rfc/rfc6749#section-4). ----- To generate an authorization URL, call method 'authorizationUrlWithParams' with some query parameters.--- For instance, @state@, @scope@ etc.+-- To generate an authorization URL, call method 'authorizationUrl', then call 'appendQueryParams' to+-- append additional query parameters, e.g. @state@, @scope@ etc.+-- -- That method will also automatically append following query parameter to the authorization url. -- -- @@@ -122,7 +123,7 @@ import Network.HTTP.Conduit (newManager, tlsManagerSettings) import Network.HTTP.Types (status302) import Network.OAuth.OAuth2.AuthorizationRequest- ( authorizationUrlWithParams,+ ( authorizationUrl, ) import Network.OAuth.OAuth2.HttpClient (authGetJSON) import Network.OAuth.OAuth2.Internal@@ -130,6 +131,7 @@ OAuth2 (..), OAuth2Error, OAuth2Token (accessToken),+ appendQueryParams, ) import Network.OAuth.OAuth2.TokenRequest (fetchAccessToken) import Network.OAuth.OAuth2.TokenRequest qualified as TR@@ -156,11 +158,11 @@ authorizeUrl :: URI authorizeUrl =- authorizationUrlWithParams+ appendQueryParams [ ("scope", "openid profile email"), ("state", randomStateValue) ]- auth0+ $ authorizationUrl auth0 -- | You'll need to find out an better to create @state@ -- which is recommended in <https://www.rfc-editor.org/rfc/rfc6749#section-10.12>