on develop help sign in
fix example of installed application authorization
382f112Aleksey Makarov
gogol/src/Network/Google/Auth/InstalledApplication.hs+11−12
@@ -55,23 +55,22 @@ import qualified Network.HTTP.Conduit as Client
55-- > {-# LANGUAGE ScopedTypeVariables #-}
55-- > {-# LANGUAGE ScopedTypeVariables #-}
56--
56--
57-- > import Data.Proxy (Proxy (..))
57-- > import Data.Proxy (Proxy (..))
58+-- > import Data.Text as T
59+-- > import Data.Text.IO as T
58-- > import System.Exit (exitFailure)
60-- > import System.Exit (exitFailure)
59-- > import System.Info (os)
61-- > import System.Info (os)
60-- > import System.Process (rawSystem)
62-- > import System.Process (rawSystem)
61--
63--
62−-- > import qualified Data.ByteString as BS
63−-- > import qualified Data.ByteString.Lazy.Char8 as LBS8
64−-- >
65−-- > redirectPrompt :: forall s. OAuthClient -> proxy s -> IO (OAuthCode s)
64+-- > redirectPrompt :: AllowScopes (s :: [Symbol]) => OAuthClient -> proxy s -> IO (OAuthCode s)
66-- > redirectPrompt c p = do
65-- > redirectPrompt c p = do
67−-- > let url = LBS8.unpack (formURL c (Proxy :: Proxy s))
66+-- > let url = formURL c p
68−-- > putStrLn $ "Opening URL " ++ url
67+-- > T.putStrLn $ "Opening URL " `T.append` url
69−-- > case os of
68+-- > _ <- case os of
70−-- > "darwin" -> rawSystem "open" [url]
69+-- > "darwin" -> rawSystem "open" [unpack url]
71−-- > "linux" -> rawSystem "xdg-open" [url]
70+-- > "linux" -> rawSystem "xdg-open" [unpack url]
72−-- > _ -> putStrLn "Unsupported OS" >> exitFailure
71+-- > _ -> T.putStrLn "Unsupported OS" >> exitFailure
73−-- > putStrLn "Please input the authorisation code: "
72+-- > T.putStrLn "Please input the authorisation code: "
74−-- > OAuthCode . LBS.fromStrict <$> BS.getLine
73+-- > OAuthCode <$> T.getLine
75--
74--
76-- This ensures the scopes passed to 'formURL' and the type of 'OAuthCode' 's'
75-- This ensures the scopes passed to 'formURL' and the type of 'OAuthCode' 's'
77-- are correct.
76-- are correct.