mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-09-05 17:33:49 +02:00
Update README for new usage
This commit is contained in:
parent
b5ce151f03
commit
a5c691512e
11
README.md
11
README.md
@ -8,13 +8,12 @@ To use one of the supported providers:
|
|||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
import Yesod.Auth
|
import Yesod.Auth
|
||||||
import Yesod.Auth.OAuth2.Learn
|
import Yesod.Auth.OAuth2.Github
|
||||||
|
|
||||||
instance YesodAuth App where
|
instance YesodAuth App where
|
||||||
-- ...
|
-- ...
|
||||||
|
|
||||||
-- https://learn.thoughtbot.com
|
authPlugins _ = [oauth2Github clientId clientSecret]
|
||||||
authPlugins _ = [oauth2Learn clientId clientSecret]
|
|
||||||
|
|
||||||
clientId :: Text
|
clientId :: Text
|
||||||
clientId = "..."
|
clientId = "..."
|
||||||
@ -47,9 +46,9 @@ myPlugin = authOAuth2 "mysite"
|
|||||||
})
|
})
|
||||||
makeCredentials
|
makeCredentials
|
||||||
|
|
||||||
makeCredentials :: AccessToken -> IO (Creds m)
|
makeCredentials :: Manager -> AccessToken -> IO (Creds m)
|
||||||
makeCredentials token = do
|
makeCredentials manager token = do
|
||||||
result <- authGetJSON token "https://mysite.com/api/me.json"
|
result <- authGetJSON manager token "https://mysite.com/api/me.json"
|
||||||
return $ -- Parse the JSON into (Creds m)
|
return $ -- Parse the JSON into (Creds m)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user