-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need some help #23
Comments
If I understand correctly, you have successfully obtained a token via the That's great if you want to build your own HTTP requests for tools like curl or any http client for Node. However, this module comes bundled with a plugin for the request module which does all the work automatically (see the docs for more details). |
"If I understand correctly, you have successfully obtained a token via the authenticate method", |
You have 2 options: If you just want to make a request, change your code from: var googleAuth = require('google-oauth-jwt');
googleAuth.authenticate({
// use the email address of the service account, as seen in the API console
email: '[email protected]',
// use the PEM file we generated from the downloaded key
keyFile: 'my-service-account-key.pem',
// specify the scopes you wish to access
scopes: ['https://www.googleapis.com/auth/drive.readonly']
}, function (err, token) {
console.log(token);
}); to: // obtain a JWT-enabled version of request
var request = require('google-oauth-jwt').requestWithJWT();
request({
url: 'https://www.googleapis.com/drive/v2/files',
jwt: {
// use the email address of the service account, as seen in the API console
email: '[email protected]',
// use the PEM file we generated from the downloaded key
keyFile: 'my-service-account-key.pem',
// specify the scopes you wish to access - each application has different scopes
scopes: ['https://www.googleapis.com/auth/drive.readonly']
}
}, function (err, res, body) {
console.log(JSON.parse(body));
}); |
And how I should use this req to make google.drive.insert? |
This module will help you with the authorization part only. You need to follow the official documentation for the rest. https://developers.google.com/drive/v3/web/manage-uploads#uploads |
Hi guys, I can not get what should I do with tokens that I get after auth methods, can You show some examples, I need to make req to google.drive and make insert, where I should use token, please help, thx!
The text was updated successfully, but these errors were encountered: