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.
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 am new to GoogleAPIs and Laravel, I run a PHP web application on Laravel 8 in a virtual Linux environment. Socialite and Drive API was working fine and out of sudden it doesn't work anymore and always return connection refused error after long period of loading as follows:
GuzzleHttp\Exception\ConnectException
Connection refused for URI https://www.googleapis.com/oauth2/v4/token
I had tried to create a new credential with new refresh token and checked all the network settings, and always clear config cache and restart apache for all troubleshoots I have tested, yet the error still exists.
I would appreciate it much if anyone could enlighten me on what are the aspects I shall look into it.
There are multiple issues in this question.
First and foremost, you are sending your secret to a third party. This means that they are able to do any API calls as you (using your name and quotas). Even if they claim that they won't, they can. Please remove any secret you may have and create new ones.
As for the OAuth 2.0, you seem to be using an old URL. You should probably take a look into the official documentation for:
Using OAuth 2.0 to Access Google APIs for a basic explanation.
Using OAuth 2.0 for Web Server Applications for making a web and getting permissions to get/modify a user's data (can be yourself).
Using OAuth 2.0 for Server to Server Applications for using a service account to execute as one of the users on your organization, without the need of manually giving permission.
Also notice that there are PHP libraries officially supported by Google to make your life way easier. See the Drive API's PHP Quickstart.
I want to access, view, modify Google docs but via a program written in php.
I would prefer to use API protocol as it can be used by any language.
But apparently the API requires me to be signed in in a browser. Now if I want to make a server side script that apparently wont be running in a browser, how can I do that?
I didnt found any username/password/auth giving thing that returns me some token and the API can use that token.
https://developers.google.com/google-apps/spreadsheets/#changing_contents_of_a_cell
google would not know who sent the second request if it does not has the access token or some way to prove that it logged in a minut a go. in my case: the program (lets say php server)
I guess this would not help https://developers.google.com/google-apps/spreadsheets/#authorizing_requests for https://developers.google.com/google-apps/spreadsheets/#changing_contents_of_a_cell as the later has no access token option.
You should authenticate your clients with OAuth2 and then store the tokens in db: https://developers.google.com/drive/web/auth/web-server
Also there's a client library available from Google: https://developers.google.com/api-client-library/php/
Edit: As you said it's about the spreadsheet API I'm linkin directly to the spreadsheet API authentication documentation: https://developers.google.com/google-apps/spreadsheets/#authorizing_requests_with_oauth_20 seems they support OAuth2 too.
Thanks to all but I found something working exactly as required.
http://framework.zend.com/manual/1.12/en/zend.gdata.html
I'm trying to implement Google Drive API. They have quick start example here which is using Google OAuth 2.0. Using for a web application where user will use drive api for creating folder and save files, edit files etc.
Now the problem is OAuth 2.0 is redirecting the page and for authCode and then back to callbackUrl again ie. the usual way. Is there any way so that I can get the authCode without redirecting the url, by using cURL or some library that can do that without redirecting.
I'm using PHP for this app.
We currently offer an alternative flow for installed apps that doesn't redirect back to an app but outputs the exchange code. In order to be sure that user is explicitly giving permissions to your application, we need to intercept the flow for a user action.
If there are no end users involved in your use case, you may like to take a look at the service accounts: https://developers.google.com/accounts/docs/OAuth2ServiceAccount Service accounts also provide impersonation for Google Apps domains.
I would like to know if the oAuth wrap authentication facility by windows live is just for messenger connect or what?
Can it be used for Live Contacts API?
I am trying to fetch addressbook from live contacts. How can i do that?
Microsoft's msdn documentation on various APIs sucks to the core!! They doesnt even have any specific working PHP example for this.
Can somebody redirect me to the well organized documentation/tutorial on this?
Not sure if you've figured this out yet, but I am looking into it as well. I don't have a working sample yet, but the answer is YES, OAuth WRAP can be used for the Live Contacts API as well as any other Messenger Connect APIs. It's actually fairly straightforward if you've used OAuth before. You would obtain authorization as with any other provider (eg. Facebook, LinkedIn, Google, etc.), and then obtain an access token:
http://msdn.microsoft.com/en-us/library/ff750952.aspx
You would then pass that access token in the Authorization header (curl_setopt, CURLOPT_HTTP_HEADER) and continue with the REST call as if you had authorized using the Live SDK.