service-accounts

How do I call the gmail api in Spring Boot 2.x using a service account?

三世轮回 提交于 2019-12-02 18:50:14
问题 I have a GSuite service account configured to access corporate user gmail accounts, I have provided it with all of the privileges in the G Suite Admin console including Domain Wide access. I create a service account and now want to use the credentials to send emails on their behalf. Here is my code so far: public void gmailTest(){ log.info("Gmail test"); List<String> SCOPES = new ArrayList<String>(GmailScopes.all()); // List<String> SCOPES = GmailScopes.all(); InputStream resourceAsStream =

Folders are not shown under root directory when use 'root' in parents when using Google Drive api files list

旧巷老猫 提交于 2019-12-02 12:09:28
问题 I just wanted to see folders and files under root directory when i set ‘root’ in parents in Q, but I can see only one file titled “Get started” pdf file. (I used C# code) Where are my folders? But I can see folders when I search by name (ex. name=’Folder1′) in the code. Also I can see the folder output when I use Api test called “Try this API” which is on API help website (https://developers.google.com/drive/v3/reference/files/list). So only C# code does not show folders? Can you please tell

Using Google Drive V3 API and service account auth, WebViewLink is null

痞子三分冷 提交于 2019-12-02 09:32:03
问题 I am using google drive v3 api to upload a file and then preview it in browser using web view link in the response. But web view link is coming null. When i was using v2, I was able to do it using alternate link. I have not set the parent ref so I am assuming as per the documentation, the file is stored in my drive folder(root) of service account. As I couldn't login to service account, so I shared the file with my existing test gmail account and it was shared. My question is how can I open

How do I call the gmail api in Spring Boot 2.x using a service account?

冷暖自知 提交于 2019-12-02 08:39:54
I have a GSuite service account configured to access corporate user gmail accounts, I have provided it with all of the privileges in the G Suite Admin console including Domain Wide access. I create a service account and now want to use the credentials to send emails on their behalf. Here is my code so far: public void gmailTest(){ log.info("Gmail test"); List<String> SCOPES = new ArrayList<String>(GmailScopes.all()); // List<String> SCOPES = GmailScopes.all(); InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("Program Name-12345678.json"); try {

How do I authorize a service account for Google Calendar API in Ruby?

雨燕双飞 提交于 2019-12-02 08:28:55
How do I authorize a service account for Google Calendar API in Ruby? I tried the quick start guide, but it crashed. https://developers.google.com/calendar/quickstart/ruby#step_3_set_up_the_sample quickstart.rb require 'google/apis/calendar_v3' require 'googleauth' require 'googleauth/stores/file_token_store' require 'fileutils' OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'.freeze APPLICATION_NAME = 'Google Calendar API Ruby Quickstart'.freeze CLIENT_SECRETS_PATH = 'client_secrets.json'.freeze CREDENTIALS_PATH = 'token.yaml'.freeze SCOPE = Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY ## # Ensure

Folders are not shown under root directory when use 'root' in parents when using Google Drive api files list

别来无恙 提交于 2019-12-02 05:33:15
I just wanted to see folders and files under root directory when i set ‘root’ in parents in Q, but I can see only one file titled “Get started” pdf file. (I used C# code) Where are my folders? But I can see folders when I search by name (ex. name=’Folder1′) in the code. Also I can see the folder output when I use Api test called “Try this API” which is on API help website ( https://developers.google.com/drive/v3/reference/files/list ). So only C# code does not show folders? Can you please tell me why it shows only files, not folders? FYI: I authenticated using service account and used Google

Using Google Drive V3 API and service account auth, WebViewLink is null

倾然丶 夕夏残阳落幕 提交于 2019-12-02 04:24:36
I am using google drive v3 api to upload a file and then preview it in browser using web view link in the response. But web view link is coming null. When i was using v2, I was able to do it using alternate link. I have not set the parent ref so I am assuming as per the documentation, the file is stored in my drive folder(root) of service account. As I couldn't login to service account, so I shared the file with my existing test gmail account and it was shared. My question is how can I open the file in browser using System.Diagnostics.Process.Start(newFile.WebViewLink); here is my code: { File

Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ “error” : “invalid_grant” }

这一生的挚爱 提交于 2019-12-02 01:57:00
问题 I have a Prediction app that's based on Google-api-php client version 1.0.0 latest. it's perfectly working in the localhost environment. but when I deploy same exact app into the hosting server environment it's gave me following issue. THIS IS THE ERROR I GOT FROM HOSTING ENVIRONMENT Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /home/predict/public_html/predict/Google/Auth/OAuth2.php:335

Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ “error” : “invalid_grant” }

北战南征 提交于 2019-12-01 20:16:38
I have a Prediction app that's based on Google-api-php client version 1.0.0 latest. it's perfectly working in the localhost environment. but when I deploy same exact app into the hosting server environment it's gave me following issue. THIS IS THE ERROR I GOT FROM HOSTING ENVIRONMENT Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /home/predict/public_html/predict/Google/Auth/OAuth2.php:335 Stack trace: #0 /home/predict/public_html/predict/Google/Auth/OAuth2.php(294): Google_Auth_OAuth2-

Google sheets API v4 Create sheet and invite users

人盡茶涼 提交于 2019-12-01 17:38:31
问题 I am using a service account authentication to create a google sheet using the Google Sheets API. I want to create a spreadsheet and somehow allow my team to open it. $private_key = file_get_contents($rootDir . '/config/googleApiCredentials.p12'); $client_email = 'project-names@positive-water-134xxx.iam.gserviceaccount.com'; $scopes = implode(' ', ["https://www.googleapis.com/auth/drive"]); $credentials = new \Google_Auth_AssertionCredentials( $client_email, $scopes, $private_key ); // tried