android-publisher verification testing - google-apis-explorer

Hi I am currently working on an app with an in-app-shop. Now I need to implemented Server Side Verification for Google In-app-purchases. We use https://github.com/googleapis/google-api-php-client for the verification. We already got the in app purchases and have tested the in app purchases with the test products (android.test.purchased). Is there a way to test the validation ? In the moment i get the following response when using a "android.test.purchased" for the following call
$googleApiResult = $service->purchases_products->get($_ENV['PACKAGENAME'], $productId, $token);
{
"error": {
"code": 400,
"message": "Invalid Value",
"errors": [
{
"message": "Invalid Value",
"domain": "global",
"reason": "invalid"
}
]
}
}
In the docs it states that you need the productive data. The app has already an Alpha Track. On the alpha track in the Google Store the in app purchases are also approved but cannot get verified by the backend. Since the alpha track is a productive enviroment, we do not have the console or network logs to check whats the problem. What is the best practice here. Is there a way to debug verification ?

In my case the problem is insufficent permission of my Google Client. I used the tokens which we got from the productive enviroment and used them in the local api.

Related

Does the Forge model.sync webhook have different security/scope rules than others?

We've been using the Forge DM webhooks for some time.
But when we attempt to register an adsk.c4r/model.sync webhook, it gives a 401 error. We have all of the "data"-related scopes set in our token.
{
"id": "22c519a4-0afd-46f5-b80e-3a718fe6b5a1",
"status": 401,
"code": "AUTHORIZATION_ERROR",
"detail": [
"User authorization was not defined for eso with system id: adsk.c4r and event id: model.sync"
]
}
Is there something else that needs to be authorized differently?
My apologies for the delay, we have some backlog in the work queue. After discussing with our engineering team, the C4R related hooks support 2LO access token only currently. Sorry for the bad news.

How do I access the inner data in this Google Custom Search errors array?

I have a web app using Google Custom Search via REST. So far, everything works fine, but when I exceed the allotted daily quota of queries, I want to give the user some info about it. I get this JSON response, and I can access the "code" and "message" data using response.error.code and response.error.message, but I don´t know how to access the subset "errors", specifically "reason".
I know this is a JSON question, but I don´t have much experience with it.
This is the JSON structure I receive (which is what I expect)
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceeded",
"message": "This API requires billing to be enabled on the project. Visit https://console.developers.google.com/billing?project=323544036192 to enable billing.",
"extendedHelp": "https://console.developers.google.com/billing?project=323544036192"
}
],
"code": 403,
"message": "This API requires billing to be enabled on the project. Visit https://console.developers.google.com/billing?project=323544036192 to enable billing."
}
}
I found the solution trying different things. I think I got lucky.
console.log(response.error.errors[0].reason);
This gives me the data I was trying to access.

How to get specific items in Microsoft Graph´s JSON response

Hello I am using Microsoft Graph with OneNote and when I make the following request : https://graph.microsoft.com/v1.0/me/onenote/pages?$select=title,links
I get this response:
I don´t need the "oneNoteClientUrl" attribute, so How can I get only the "oneNoteWebUrl" attribute.
And when I use: pages? search=item&select=title,links.
I get this issue.
{
"error": {
"code": "10002",
"message": "The service is currently unavailable. Please try again later.",
"innerError": {
"request-id": "13535682-a12b-4127-935b-6601154c1416",
"date": "2017-05-31T21:38:04"
}
}
}
I read that "search is available for consumer notebooks only"
How can I get pages with specific words in their content and title?
Unfortunately, the API doesn't yet support searching pages in SharePoint - only in OneDrive consumer. This is something in our radar, but we don't yet have any ETA on this.
I encourage you to create/upvote a uservoice entry for this.
https://onenote.uservoice.com/forums/245490-onenote-developer-apis

Google Drive API files setq sharedWithMe=false causes "500 Internal Server Error"

Is this a bug or am I entering value incorrectly?
To repeat, go to "Try it!" on google sdk files page:
https://developers.google.com/drive/v2/reference/files/list#try-it
Try getting files (you'll need to authorize); then try entering sharedWithMe=false in the setQ field.
I get the following error (interesting that sharedWithMe=true succeeds):
500 Internal Server Error
- Show headers -
{
"error": {
"code": 500,
"message": null
}
}
Anyone know why?

Calendar API Response with '403: Daily Limit Exceeded' - Google Chrome Extension

I started with an little application for showing some relevant information to our developer team, which is collected from different sources. Like google calendar, our project backoffice, an openarena server-logs etc.
I started with an web application, but then decided to switch the project to an chrome extension. Now i already had the google calendar integration up and running using the V3 Javascript(alpha) Client-Lib. This wasn't working anymore because i had to change the OAUTH dance, from the one for web-apps, to the one for packaged/installed apps.
For this i followed the tutorial (It's my first extension.) http://code.google.com/chrome/extensions/tut_oauth.html and got the OAUTH dance working again. Now i'am trying to request my calendar-data from the google api using the signedRequest-Methode from the tutorial, but alway receive the response "Daily Limit Exceeded. Please sign up" (Api Console shows i haven't performed any request).
Maybe someone has an idea what i am doing wrong here, because i tried everthing i could think about. Thanks in advance, Florian
Code -
manifest.json:
{
"name": "MIS",
"version": "0.1",
"description": "Monitor Information System",
"background_page": "background.html",
"browser_action": {
"default_icon": "img/mis/icon.png",
"default_title": "Mis"
},
"permissions": [
"tabs",
"https://www.googleapis.com/",
"https://www.google.com/"]
}
background.html:
...
oauth = ChromeExOAuth.initBackgroundPage
({
'request_url':'https://www.google.com/accounts/OAuthGetRequestToken',
'authorize_url':'https://www.google.com/accounts/OAuthAuthorizeToken',
'access_url':'https://www.google.com/accounts/OAuthGetAccessToken',
'consumer_key': 'anonymous',
'consumer_secret': 'anonymous',
'scope': 'https://www.googleapis.com/auth/calendar',
'app_name': 'Mis'
});
...
main.html Methode call:
function performCalendarEventsRequest(calendarId)
{
var requestUrl = 'https://www.googleapis.com/calendar/v3/calendars/'+calendarId+'/events';
var request = {
'method': 'GET',
'headers': {
'GData-Version': '3.0',
'Content-Type': 'application/atom+xml'
},
'parameters': {
'alt': 'json'
},
'body': 'Data to send'
};
oauth.sendSignedRequest(requestUrl, calendarEventsRequestCallback, request);
}
Since your consumer key and secret are both set as anonymous you are not identifying your application in any way.
You can either replace these with the Client ID and Client secret values respectively, which can be found on the API Access tab on your projects page in the API Console, or you can pass the API key (found just under the auth tokens on the same page) using an additional key parameter.
This is the same for most Google APIs.
Source: http://code.google.com/apis/calendar/v3/using.html#APIKey
I know this is an old question but I was stuck in the same error using the PHP implementation (Beta) of the API (2016-01-06), because I initially thought the setAuthConfigFile was all it was needed:
$client = new Google_Client();
$client->setApplicationName('MyCalendarAppName');
$client->setAuthConfigFile(APPPATH.'client_secret.json'); //file downloaded from GDC:
// https://console.developers.google.com/apis/credentials?project=YOUR-PROJECT-ID
$client->addScope(Google_Service_Calendar::CALENDAR_READONLY);
$service = new Google_Service_Calendar($client);
The error was not really due to a "daily limit" of requests but to the fact that I (owner of the Google account) hadn't explicitly given access permissions to the calendar. This is how to do it:
access the URL returned by the createAuthUrl() method (which can be invoked before calling the service);
a "Deny" and "Allow" form for accessing the calendars shows up – press Allow;
a code is returned – copy&paste this code to the authenticate($code) method and voilá, no more 403: Daily Limit Exceeded errors.
For doing this, just use the following lines before invoking the service:
//$client->createAuthUrl();
// - invoke the method above one time only: returns a URL with the "Allow" form
// which will give the code for authentication
$client->authenticate('YOUR_CODE_GOES_HERE');
$service = new Google_Service_Calendar($client); //invokes the Calendar service
However, this will allow a one time access to the calendar. If you try this twice, you get:
Google_Auth_Exception: Error fetching OAuth2 access token, message: 'invalid_grant: Code was already redeemed.'
Meaning that a token is needed to reaccess the calendar with the reedemed code. This token is returned by the authenticate method and can be assigned to the client through the setAccessToken method:
//get the access token you previously stored or get a new one to be stored:
$accessToken = $client->authenticate('YOUR_CODE_GOES_HERE');
//after the if-else blocks...
$client->setAccessToken($accessToken);
//refresh the token if it's expired
if ($client->isAccessTokenExpired())
$client->refreshToken($client->getRefreshToken());
The goal is to reuse that access token repeatedly (implicitly also reusing the redeemed code) and only invoke a refreshToken when the token expires. Google's quickstart creates a specific file for storing this token (calendar-php-quickstart.json) and only uses the authenticate method when the token is not found in that file. I.e. the setAccessToken is the only Client authentication method (besides the setAuthConfigFile) that needs to be used in subsequent requests.
I only fully understood this OAuth 2.0 logic by going through these errors and since this question attracted so many people already, perhaps this may help others...