Popularity
5.8
Growing
Activity
0.1
-
7
2
4

Monthly Downloads: 101
Programming language: Haskell
License: MIT License
Tags: Google     Unclassified    
Latest version: v0.3.0.0

google-oauth2 alternatives and similar packages

Based on the "Unclassified" category

Do you think we are missing an alternative of google-oauth2 or a related project?

Add another 'Unclassified' Package

README

Google OAuth2

Interactive Google OAuth2 token negotiation

Usage

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

module Main (main) where

import Data.Aeson
import Data.Semigroup ((<>))
import Network.Google.OAuth2
import Network.HTTP.Simple
import Network.OAuth.OAuth2
import Data.Text.Encoding (encodeUtf8)

main :: IO ()
main = do
    OAuth2Token{..} <-
      getAccessToken
        "<CLIENT_ID>"      -- Fill with real ID.
        "<CLIENT_SECRET>"  -- Fill with real code.
        ["https://www.googleapis.com/auth/drive"]
        (Just "path/to/credentials.cache")

    request <- parseRequest "https://www.googleapis.com/drive/v2/files"
    response <- httpJSON $ authorize (atoken accessToken) request

    print (getResponseBody response :: Value)
 where
   authorize token = setRequestHeaders
       [ ("Authorization", encodeUtf8 $ "Bearer " <> token)
       ]

Prior Art

This module was inspired by handa-gdata which appears to be abandoned.


[CHANGELOG](./CHANGELOG.md) | [LICENSE](./LICENSE)


*Note that all licence references and agreements mentioned in the google-oauth2 README section above are relevant to that project's source code only.