napkin-0.5.14
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageGHC2021

Napkin.Auth.GoogleOAuth

Description

 
Synopsis

Documentation

type OAuth2TokenByteString = ByteString #

Alias for OAuth2Token Lazy ByteString received from google oAuth service

displayCredentials :: Katip m => OAuth2Env -> m (Maybe CredentialsJson) #

Shows effective credential file

findCredentials :: Katip m => OAuth2Env -> m (Maybe CredentialsJson) #

FInds effective credential file

authResetWorkflow :: Katip m => OAuth2Env -> m (Maybe CredentialsJson) #

Resets authentication workflow removes the previously cached napkin auth file for this project

toGCredential :: OAuth2Conf -> OAuth2Token -> GCredentials #

Adds the required client_id and client_secret to the oAuth token

o2TokenFromO2Code :: (MonadIO m, MonadCatch m, Katip m) => OAuth2Env -> OAuth2Code -> m ByteString #

Exchange authorization code for access token. Step 5 of the google oauth flow, see diagram https://cloud.google.com/community/tutorials/understanding-oauth2-and-deploy-a-basic-auth-srv-to-cloud-functions

decodeO2Token #

Arguments

:: MonadCatch m 
=> OAuth2TokenByteString

oAuth2 token received from google oAuth backend

-> m OAuth2Token 

decode oAuth2Token

saveOAuth2Credentials #

Arguments

:: MonadIO m 
=> OAuth2Env 
-> ByteString

Google Credential

-> m (Maybe CredentialsJson) 

Creates credential file We 1st create a temp credential file. if we can create a Bigquery google environment, then the temp file is cashed for future use

authWorkflow :: (MonadIO m, MonadCatch m, Katip m) => OAuth2Env -> m (Maybe CredentialsJson) #

Authentication workflow The work-flow : + creates credential file and stores in OS $TMP folder + attempts to create google env and bigquery env + if success, cache the tmp file napkin we'll know location for future use.