How to authenticate with OAuth?
See original GitHub issueHello, i attempt to connect on spreedsheet with OAuth authentication but i’m blocked. I created my OAuth, and this JSON file client_id.json
was downloaded.
{
"web": {
"client_id": "****.apps.googleusercontent.com",
"project_id": "****",
"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_secret": "****"
}
}
I naively use the JSON file from :
// OR load directly from json file if not in secure environment
await doc.useServiceAccountAuth(require('./creds-from-google.json'));
I just change the creds-from-google.json
with client_id.json
. But when i run my application i’ve got this error :
(node:12795) UnhandledPromiseRejectionWarning: Error: No key or keyFile set.
at GoogleToken.getTokenAsync (/home/myapp/node_modules/gtoken/build/src/index.js:125:19)
at GoogleToken.getToken (/home/myapp/node_modules/gtoken/build/src/index.js:77:21)
at JWT.refreshTokenNoCache (/home/myapp/node_modules/google-auth-library/build/src/auth/jwtclient.js:156:36)
at JWT.refreshToken (/home/myapp/node_modules/google-auth-library/build/src/auth/oauth2client.js:143:25)
at JWT.authorizeAsync (/home/myapp/node_modules/google-auth-library/build/src/auth/jwtclient.js:139:35)
at JWT.authorize (/home/myapp/node_modules/google-auth-library/build/src/auth/jwtclient.js:135:25)
at GoogleSpreadsheet.renewJwtAuth (/home/myapp/node_modules/google-spreadsheet/lib/GoogleSpreadsheet.js:86:26)
at GoogleSpreadsheet.useServiceAccountAuth (/home/myapp/node_modules/google-spreadsheet/lib/GoogleSpreadsheet.js:81:16)
at /home/myapp/index.js:10:15
at Object.<anonymous> (/home/myapp/index.js:18:3)
I wonder if there is fonction like useOAuth()
. My google-spreadsheet version is 3.0.11. Thank you in advance 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
End User Authentication with OAuth 2.0
A standard for user authentication using OAuth: OpenID Connect · ID Tokens · UserInfo Endpoint · Dynamic server discovery and client registration ·...
Read more >Using OAuth 2.0 to Access Google APIs | Authorization
Google APIs use the OAuth 2.0 protocol for authentication and authorization. ... To begin, obtain OAuth 2.0 client credentials from the Google API...
Read more >Authenticate an IMAP, POP or SMTP connection using OAuth
Learn how to use OAuth authentication to connect with IMAP, POP or SMTP protocols and access email data for Office 365 users.
Read more >Authorization vs Authentication - OAuth 2.0 Simplified
Specifically, OAuth 2.0 does not provide a mechanism to say who a user is or how they authenticated, it just says that a...
Read more >Chapter 13. User authentication with OAuth 2.0
Because OAuth 2.0 is used to gather the consent of an authenticated end user, many developers and API providers have concluded that OAuth...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This json document is not the same as a service account. It is possible to connect via oauth, but there is not nice built-in support and I do not have a good example. Will try to add it in the next batch of work
Oauth support is now published - check out https://theoephraim.github.io/node-google-spreadsheet/#/getting-started/authentication?id=oauth for more info
@JacobRichardson @alxndr - if you are still having problems, please open new issues!