I want to create a new Id Client Oauth 2.0 for Google Drive API, then generate the object JSON (oauth credentials), download it and place it in a specific folder, without the use of the console developers google. Is there a script (in php or javascript) that produce this with the email and password of a google account?
I want to create this "standalone script" because I dont want that the client must go before on the google console (although it will be for one-time).
thanks,
Matteo
It is not possible to programmatically create a project on Google developer console. The only way to create a new project is to do it though the website manually.
You are not going to find a script or anything to allow you to do this. The only think that remotely resembles this is the Google Cloud Resource Manager API but its not going to let you create credentials.
Related
I am new to AZURE O365 portal, I have created some users in azure portal.
How can I create API in Azure portal to get the user details which I have already created in the portal and are they users enabled or disabled using PHP.
I tried: I have created application and I created secret Id in the portal, then what I have to do, to generate API for user list using php.
please help on it.
Thanks
Sandeep
Not sure if I undestand you correctly: you created some users on the azure portal and you want to get these users using PHP?
Azure has many APIs, they also have an API for getting these users, here is the specification and example code (not in php, but I think still easy to understand):
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
Basically you can access that data using graphql client. There are many graphql libraries for php. But as I skimmed through the docs, you don't really need a library, just a way to create http requests, I recommend Guzzle.
Before you create that php code, I recommend to simply play with the API by using postman or other api client. If it works there, you can start to create the php code.
The code is basically a http POST request (or whatever is specified in the documentation). The request should contain your API tokens in the header, thats all. Data will be provided usually as JSON. Here are some examples how to use guzzle in php for graph.
I have a small site/web application where registered users can see some files that I periodically prepare for them; I store these files in separate directories and every user can only see and download their own files.
Now, I'm moving these directories to Google Drive and I would keep functionalities like file listing and downloading.
Reading the official docs I found some interesting examples about file download/upload, but all of them talk about authorization that user must give in order to access to their Drive and this is not what I'm looking for, I don't want access to their Drive!
As I can see, the doc is not contempling the case that someone may want to give (read-only) access to own Drive. But maybe I'm missing something...
Basically, I need the list of files on my Drive account and, if requested, a way to download one (or more). The only one that has the auth to Drive account is my server, users will send request from it.
Is it possible? I think yes, but I can't find any docs about that. How can I authorize my server?
I think you're looking for the Using OAuth 2.0 for Web Server Applications where you'll be using service accounts to achieve your goal.
"This document explains how web server applications use the Google API
Client Library for PHP to implement OAuth 2.0 authorization to access
Google APIs. OAuth 2.0 allows users to share specific data with an
application while keeping their usernames, passwords, and other
information private. For example, an application can use OAuth 2.0 to
obtain permission from users to store files in their Google Drives."
The snippets are in PHP too, so it works in your favor.
I am implemented In App Billing for android.I wanted to implement subscription validity checking through my backend server. As Google Play Documentation, for making call for Google Play API,need authentication using oauth 2.0.
I followed instructions for registering project and creating credentials. But from there I have no idea how to use those credentials, I tried authentication via CURL request, but it asking permission as shown in follwing image
This permissions works fine I can exchange code and get access token, but all this done by manually, how should I implement this on backend.
I even try to use google api php library provided by Google, but It adds confusion. Also they didn't provide any example, how to use library.
Can anybody elaborate how exactly use library or pure php?
Thanks in advance.
To perform LVL and/or IAB validation on a server, do not access Google servers directly from the server. Even if all information were available, you would face integrity problems, because your app and your server will see different information due to synchronization latencies.
Instead, use your app as a proxy and validate the Google Play information on your server as described here.
I need to create an external php web application (PHP) to connect to Google Drive using the API. Problem is that the quick start example illustrates that the user has to visit a url to obtain an authorization code to complete the authorization. Is there a way to achieve the authorization automatically without any user interaction. I need to basically copy an existing doc template automatically via the web application.
This is not possible without authorization, but is possible without user interaction. Please see the Drive SDK documentation sections on domain delegation and service accounts. Service accounts is likely what you need.
I am trying to access google calendar from php program. I am using a php program as middle person to communicate with my android program and Goolge Calendar.
Google provided API to access calendar. when I try to access calendar it asks for authentication, then Login to google account, then Grant Access permision. My problem is I don't need multiple steps to access calendar. I will send Gmail ID and Password from android program to php by calling Calendar.php(For ex:), then php should receive that and directly login to Google Calcendar.
You cannot do this. Google uses OAuth for all it's 3rd party plugins, so the user has to go to a google page to authenticate, and then your app is given an OAuth key to use.
This is to stop you from maliciously storing the username and password given to your app and mis-using it.
Have you try the Canlendar.php demo from ZEND_GDATA which provided by google?
specially function 'outputCalendar'.that's the function to retrieve events from google calendar.
You can preview codes here
you should download demos somewhere and check yourself :)