Background:
Creating a project where a user can create/edit/delete a calendar events on my calendar without the need to authenticate themselves. They can add or remove users on that calendar event. I have credentials to my google account to authenticate the requests. I want to talk directly to google calendar api without the need to insert username/password (which I can provide from the backend, if required).
Technology:
PHP7.0/ SQL SERVER/ JavaScript
Issue/Requirement:
I have created the project in Google and added credentials for "service account key". I have all the required keys for creating the project. How do I talk to the google server directly without using a frontend page or console and directly go ahead with creating an event?
Any suggestions welcomed. On a time crunch here.
How to quickly set up a PHP project using Google Calendar API: https://developers.google.com/calendar/quickstart/php
How to authenticate with a service account using Google APIs on PHP: https://github.com/googleapis/google-api-php-client#authentication-with-service-accounts
How to create events using the Calendar API using PHP language: https://developers.google.com/calendar/create-events#metadata
Using all the examples above you should be able to easily build yourself the solution you want.
Furthermore, I would suggest you check out the community guidelines on how to ask good questions.
Related
Hi, I want the users of our organization only to use google picker to select files from their google drive.
I followed this example to set up API key and oAuth client in the google developer console.
Here is the summary of what I did:
Enabled Google Picker API in Google API Console
Created API Key
Created OAuth client
Using Official Example google picker is working but it allows all Gmail users as well, I want to allow only those emails which belong to my domain.
I could not found anything related to this in official docs so I have the following questions:
Is it possible?
Is it possible to bypass the consent screen using service account impersonation(User Access Token generated on the server via impersonation)?
This is a high level explanation, but the idea is the following:
Using a server side script, you will generate a token for a user using a service account and impersonation.
On the client side, you will have to call that script on the server side and have the server return the token.
When initializing the picker, you will set the token to what you received from the server using the PickerBuilder.setOAuthToken() method.
That way you not only bypass the consent screen, but also make sure the drive picker presents the drive files of the user you authenticated with the service account.
If you are looking for a low level explanation, edit your question and post your architecture along with your code.
I am trying to create a web form that will post data to my google sheet. I am finding that the only way to do this is to use OAuth2 where the client needs to authenticate with google. Is there a way that I can post to my own sheet without having to do the OAuth? I want to avoid having the google screen popup when trying to submit the form. Anyone know how to do this, without a hack? If it has to be done server-side, I am using PHP. Thanks
If it's your Google sheet that you are using for all visitors, then you only need to follow the flow once to obtain a refresh token and use a service account. This obviously has to be done server-side, otherwise you expose your credentials to every visitor.
This guide Using OAuth 2.0 for Server to Server Applications explains the process.
I am making a web-bot that checks every day if I have a new work in my time table.
If there is a new work date then it must add it to my Google Calendar.
But how do I login with the Google Calendar API, because the web page is not accessed by users. So how do I do that?
There is no Google API docs for web bots. However I found a Github repo called Telegram bot using Google Calendar API. This bot can interact with Google Calendar API, allowing you to easily add/manage events.
According to their page, this is currently up and running and you may use it:
https://telegram.me/google_calendar_bot
Also, since you're not going to use manual authorization from users, service accounts might be able to help you in the log-in part.
I'd like to allow a user to visit one of my sites, enter some information into a field, and then save that information into a Google Spreadsheet via JavaScript.
I don't want the user to login via Google or have to do any special authentication.
It's Ok if the spreadsheet needs to be open to public; the data's not sensitive.
I don't want to use a Google Form, I want to have full control over the client-side UI.
I've been reading through the Google developer docs, but they only make mention to an OAuth login solution. The Google Developer Console allows you to create a "Public API access key", but does not explain how it's used.
All of the examples are for the scenario where the user is using your app to access his own files. In your case, you want the app to access your own file. This isn't easy. The only ways I can see are :-
Use a server app (appengine works well) to do the access
Very carefully set up permissions and store a refresh token in your app.
Option 2 could be your worst security nightmare if you don't do it carefully, and even then may be an infringement of Google T's and C's since it's akin to distributing your password.
Once you figure out the auth, you'll need to check out the spreadsheet API (https://developers.google.com/google-apps/spreadsheets/), as this is the API that allows you to update an existing spreadsheet. The Drive API can only upload an entire new spreadsheet.
I'm looking for a way to use Google Drive to share data between a Android app and a web page hosted on my server. The web page should use JavaScript to retrieve and store data in Google Drive.
The data should only be exchanged between the browser of the user and Google Drive.
According to the documentation of accessing Google Drive from JavaScript you must first create a application using the Google Cloud Console, register it and get a client ID before you can use JavaScript to access the data.
I don't want to have to maintain a Google hosted application. Is this possible?
The only point of apis console is to register your applicaiton or in your case script with google. Its baslcy just there way of keeping track of whos accessing what i think. Once you have it registered you normaly would use a clientid and stuff as well as Oauth2 to allow users to access there google drive with your script. But you wont need to go into that becouse its your application thats storing its data there and not a user.
You will probably want to look into a service account.
https://google-developers.appspot.com/drive/service-accounts
If you want to use private spreadsheet then you have to use authentication, in this case google project is easiest one. If you don't want to use private then you can publish your spreadsheet and then make ajax call without authentication/goole project.
You're not the first person we've heard this complaint from. People want to be able to log in and create an API key without having to deal with extraneous cloud services. We're working on some things to make life easier for customers like you.
Unfortunately there is no way to do this at the present time. That said, you don't have to actually maintain a separate application. You can create a project and only use it to manage APIs.