mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-01-15 21:58:29 +01:00
* oauth2 functions now handle the getCreds argument themselves * Learn is updated to do the Right Thing * Google is unfinished
31 lines
901 B
Haskell
31 lines
901 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
-- |
|
|
--
|
|
-- OAuth2 plugin for http://google.com
|
|
--
|
|
-- * Note: this module is unfinished, do not use.
|
|
--
|
|
module Yesod.Auth.OAuth2.Google
|
|
( oauth2Google
|
|
, module Yesod.Auth.OAuth2
|
|
) where
|
|
|
|
import Data.Text (Text)
|
|
import Data.Text.Encoding (encodeUtf8)
|
|
import Yesod.Auth
|
|
import Yesod.Auth.OAuth2
|
|
|
|
oauth2Google :: YesodAuth m
|
|
=> Text -- ^ Client ID
|
|
-> Text -- ^ Client Secret
|
|
-> AuthPlugin m
|
|
oauth2Google clientId clientSecret = authOAuth2 "google"
|
|
(OAuth2
|
|
{ oauthClientId = encodeUtf8 clientId
|
|
, oauthClientSecret = encodeUtf8 clientSecret
|
|
, oauthOAuthorizeEndpoint = "https://accounts.google.com/o/oauth2/auth"
|
|
, oauthAccessTokenEndpoint = "https://accounts.google.com/o/oauth2/token"
|
|
, oauthCallback = Nothing
|
|
})
|
|
undefined -- TODO
|