Google calendar api 3 invalid credentials error - google-api

I'm trying to access calendar details but I seem to get a invalid credentials error.
I access the following url: "https://www.googleapis.com/calendar/v3/calendars/{google_id}/events"
like this :
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url_);
get.addHeader("Authorization","OAuth" + auth_token);
try {
HttpResponse response = client.execute(get);
What extra headers should I put there? I'm accessing it from an android application. If it matters I got my auth_token by an activity started with AccountManager.newChooseAccountIntent().
I'm getting the following json:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}

There should be a space between OAuth and the token in your header.

Related

Google APi Bad Request

i try to implement Passes service of Google Api in our website but we always have error 400 problem
we follow this documentation
Giftcardclass: insert
i use postman for test
POST https://www.googleapis.com/walletobjects/v1/giftCardClass
Request body
{
"kind":"walletobjects#loyaltyObject",
"id":"test2.test",
"classId":"test.test",
"version":12,
"state":"active",
"issuername":"dsadasdasdas",
"barcode":{
"kind":"walletobjects#barcode",
"type":"ean13",
"value":"aaaa",
"alternateText":"aaaa"
}
}
jSon response
{ "error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request" }
}
from the documentation seems that only id,issuerstate and reviewStatus are required.
Looks like your ids are formatted wrongly, it should be issuer_id.unique_id. See https://developers.google.com/pay/passes/rest/v1/giftcardclass#GiftCardClass.FIELDS.id for reference.

404 Property not found key / visibility when using patch request Google Drive api v2

I am using Google Drive API (v2) and used to make successful patch requests as explained here:
https://developers.google.com/drive/v2/reference/properties/patch
in order to add a new metadata property (myNewPr) into my documents.
However, recently (maybe 1-2 days) I started to receive 404 error messages:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Property not found: key = myNewPr and visibility = PRIVATE",
"locationType": "other",
"location": "property"
}
],
"code": 404,
"message": "Property not found: key = myNewPr and visibility = PRIVATE"
}
}
Any ideas ? When I am testing by using insert (https://developers.google.com/drive/v2/reference/properties/insert) it seems to work.

Getting 403() error while using google Youtube API

I am gating this Error when i use Youtube API
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=************"
}
],
"code": 403,
"message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions."
}
}
and 403() error it's showing in console

Google Fusion Table: Unauthorized with api key

I'm trying to create and query a fusion table. So what I did:
I created a new fusion table in google drive
Created a new api key
Set the fusion table to public (using share button)
Now I'm using Advanced REST client executing this request:
GET https://www.googleapis.com/fusiontables/v2/tables?key=[myapikey]
But I keep getting 401: Unauthorized
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
The docs say that this should work, but I keep getting this message. Any hint?
p.s.: The reason why I use an api key only is simply because I created a batch which sends the request, the data is public and there is no user authentication required.

google enterprise license manager api - Unauthorized operation for the given domain

The LicenseAssignments.get api returns 200 OK
Request:
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>
Response:
200 OK
- Show headers -
{
"kind": "licensing#licenseAssignment",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>",
"userId": "<email>",
"productId": "Google-Apps",
"skuId": "Google-Apps-For-Business"
}
However LicenseAssignments.listForProduct returns "403 Forbidden"
Request:
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=my_customer
Response:
403 Forbidden
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Unauthorized operation for the given domain."
}
],
"code": 403,
"message": "Unauthorized operation for the given domain."
}
}
Any idea why I get 403 forbidden for the second request?
This issue got resolved when I used 'domain name' (e.g. something.com) as 'customerId'. This is different from the usual behavior of other Google APIs where 'customerId' is 'my_customer'.
https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=<domain name>

Resources