From 8046f4d8ccc31f1d198ad2955f9863b07513f044 Mon Sep 17 00:00:00 2001 From: Freiric Barral Date: Sun, 31 Aug 2014 16:40:02 +0200 Subject: [PATCH] hardcode the scope to user:email (if more info is needed the code will anyway have to be changed to include more queries) --- Yesod/Auth/OAuth2/Github.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Yesod/Auth/OAuth2/Github.hs b/Yesod/Auth/OAuth2/Github.hs index c66df14..48ccb80 100644 --- a/Yesod/Auth/OAuth2/Github.hs +++ b/Yesod/Auth/OAuth2/Github.hs @@ -56,11 +56,17 @@ instance FromJSON GithubUserEmail where parseJSON _ = mzero oauth2Github :: YesodAuth m + => Text -- ^ Client ID + -> Text -- ^ Client Secret + -> AuthPlugin m +oauth2Github clientId clientSecret = oauth2GithubScoped clientId clientSecret ["user:email"] + +oauth2GithubScoped :: YesodAuth m => Text -- ^ Client ID -> Text -- ^ Client Secret -> [Text] -- ^ List of scopes to request -> AuthPlugin m -oauth2Github clientId clientSecret scopes = basicPlugin {apDispatch = dispatch} +oauth2GithubScoped clientId clientSecret scopes = basicPlugin {apDispatch = dispatch} where oauth = OAuth2 { oauthClientId = encodeUtf8 clientId