-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
google-iex.json:
{
"type": "service_account",
"project_id": "sheetapi-459712",
"private_key_id": "d9baee339d8485e831f2640600480ccfbe07e6fc",
"private_key": "-----BEGIN PRIVATE KEY-----\n MY_PRIVATE_KEY \n-----END PRIVATE KEY-----\n",
"client_email": "exs@api.iam.gserviceaccount.com",
"client_id": "12345",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/....",
"universe_domain": "googleapis.com"
}
config/config.exs:
config :goth, json: File.read!("google-iex.json")
in Module:
def gen_token do
scopes = [
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/spreadsheets"
]
Goth.Token.fetch(%{scope: Enum.join(scopes, " ")})
end
gen_token =>
{:ok,
%Goth.Token{
token: "some token",
type: "Bearer",
scope: "https://www.googleapis.com/auth/cloud-platform",
sub: nil,
expires: 1747161673,
account: nil
}}
Metadata
Metadata
Assignees
Labels
No labels