mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-25 12:17:45 +02:00
Fix BattleNet interface
- Incorrect indentation - We should always accept Id/Secret last - The function is oauth... not oAuth... Because of the mis-naming, at least we could fix the argument-order in a backwards-compatible way, deprecating the old function/interface.
This commit is contained in:
parent
434263fef3
commit
72c64102b0
@ -9,8 +9,9 @@
|
|||||||
-- * Returns user's battletag in extras.
|
-- * Returns user's battletag in extras.
|
||||||
--
|
--
|
||||||
module Yesod.Auth.OAuth2.BattleNet
|
module Yesod.Auth.OAuth2.BattleNet
|
||||||
( oAuth2BattleNet
|
( oauth2BattleNet
|
||||||
) where
|
, oAuth2BattleNet
|
||||||
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
@ -26,14 +27,14 @@ instance FromJSON User where
|
|||||||
pluginName :: Text
|
pluginName :: Text
|
||||||
pluginName = "battle.net"
|
pluginName = "battle.net"
|
||||||
|
|
||||||
oAuth2BattleNet
|
oauth2BattleNet
|
||||||
:: YesodAuth m
|
:: YesodAuth m
|
||||||
=> Text -- ^ Client ID
|
=> WidgetT m IO () -- ^ Login widget
|
||||||
-> Text -- ^ Client Secret
|
|
||||||
-> Text -- ^ User region (e.g. "eu", "cn", "us")
|
-> Text -- ^ User region (e.g. "eu", "cn", "us")
|
||||||
-> WidgetT m IO () -- ^ Login widget
|
-> Text -- ^ Client ID
|
||||||
|
-> Text -- ^ Client Secret
|
||||||
-> AuthPlugin m
|
-> AuthPlugin m
|
||||||
oAuth2BattleNet clientId clientSecret region widget =
|
oauth2BattleNet widget region clientId clientSecret =
|
||||||
authOAuth2Widget widget pluginName oauth2 $ \manager token -> do
|
authOAuth2Widget widget pluginName oauth2 $ \manager token -> do
|
||||||
(User userId, userResponse) <-
|
(User userId, userResponse) <-
|
||||||
authGetProfile pluginName manager token
|
authGetProfile pluginName manager token
|
||||||
@ -62,3 +63,7 @@ apiHost region = Host $ encodeUtf8 $ region <> ".api.battle.net"
|
|||||||
wwwHost :: Text -> Host
|
wwwHost :: Text -> Host
|
||||||
wwwHost "cn" = "www.battlenet.com.cn"
|
wwwHost "cn" = "www.battlenet.com.cn"
|
||||||
wwwHost region = Host $ encodeUtf8 $ region <> ".battle.net"
|
wwwHost region = Host $ encodeUtf8 $ region <> ".battle.net"
|
||||||
|
|
||||||
|
oAuth2BattleNet :: YesodAuth m => Text -> Text -> Text -> WidgetT m IO () -> AuthPlugin m
|
||||||
|
oAuth2BattleNet i s r w = oauth2BattleNet w r i s
|
||||||
|
{-# DEPRECATED oAuth2BattleNet "Use oauth2BattleNet" #-}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user