GCM / FCM: "Received ANDROID API key. Only SERVER API keys are accepted." - google-cloud-messaging

I'm trying to authenticate with google's FCM (formerly GCM) - and getting the following error message:
Received ANDROID API key. Only SERVER API keys are accepted.
I am providing FCM with an API key - which I got when I downloaded my service's "google_services.json".
perhaps its the wrong api key?

and so it took a little while, but I found the answer: I was using the wrong key. the "server key" is shown in the UI (and not in the json file you download - which (I guess) is just for clients): settings->cloud messaging. its confusing, so I got confused.
(perhaps the folks in Google could rename the api key in the file to something like "client_api_key"?)

Related

Google FCM Request

I'm working on the Google FCM message service. I deploy my API with my server it's working fine. But when I do the same within Client Production Service it gives me 401 error.
I'm running Window Service and hitting Restful API. I validate each and everything within Google account also but not able to rectify the same.
I've recently the same problem. I implemented everything right with all parameters. Finally I found the solution. I used the API Key from Google developer console and not from firebase. So go to the following url: https://console.firebase.google.com/project/YOUR_PROJECT_ID/settings/cloudmessaging/
There you can see two API keys. Choose the longer top server key.
After I replaced the key in the header Authorization: key=YOUR_KEY, it finally works.

UpgradeableApp API keeps giving "Invalid OAuth consumer key"

Given the following ruby code:
consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {
site: "https://www.googleapis.com"
})
resp = consumer.request(:put, "/appsmarket/v2/upgradableApp/#{listingId}/#{cwsId}/#{domain}")
puts resp.code+"\n"
puts resp.body
the UpgradeableApp API keeps giving "Invalid OAuth consumer key" error. The consumer key (in the format XXXXXXXXXXXX.apps.googleusercontent.com) was copied directly from the legacy marketplace listing as described in the docs.
I've:
verified the system time is correct and synchronized via ntp.
tried including xoauth_requestor_id
tried generating the request myself via curl (using this to generate the oauth signature)
tried enabling "Google Apps Marketplace API" under "Register for additional APIs" on the legacy marketplace listing
Is anybody else experiencing this? Thoughts on other things I can try?
UPDATE Sep 10 2014: I got confirmation from Google that this was an issue on their end for which a fix was applied. I've since been able to successfully use the ruby code above to do a migration.
I got confirmation from Google that this was an issue on their end for which a fix was applied. I've since been able to successfully use the ruby code above to do a migration.

Occasionally 401 Unauthorized Google Cloud Message

While using Google Cloud Message API I occasionally get 401 Unauthorized status. So, sometimes my push notifications are send and sometimes not, without changing anything in the API request.
I use curl request with server key.
I tried to specify IPs list and set it to "Any IP allowed".
I already tried to create new server keys and projects, as some people here tell it helps them in similar situation. Sadly, it not helps me.
I'm seeing a similar problem with other Google Cloud APIs and I suspect it's related to your authentication being expired. Make sure to refresh any tokens you are using.

Google Maps: "This API project is not authorized to use this API."

Recently I started coding a Google Maps service integration. I went ahead and generated an API Key associated with my business email account on bronze level. When I use the service sans API Key everything works swimmingly.
If I use the API Key parameter, with my API key generated in my developer console I get the error message:
This API project is not authorized to use this API.
The URL used to access maps is below:
https://maps.googleapis.com/maps/api/distancematrix/xml?origins={origin_address}&destinations={destination_addresses}&mode=driving&language=en-US&sensor=false&key={APIKey}
How does one get the API Key to be authorized for v3 Maps JavaScript API. I am making the call as a raw post in the ASPX code behind to that address. It seems to me this used to work fine when I first started all this, now today all of the sudden I'm getting this error.
I need this to work since I will also be using places and that service seems to only work with the API Key. I would like to be able to have the key configured once and be done with it.
You'll need to enable each API you want to use.
The maps-javascript-API is one API, the DistanceMatrix-API(Webservice) another.
Go to the developer-console->API's and enable the Distance Matrix API
Note: this is only related to the DistanceMatrix-Webservice, when you use the DistanceMatrix-Service of the Javascript-API you don't need to enable this service.

Trying to get Twitter Oauth to work in Windows 8

I am using Microsoft's authentication sample found here: http://code.msdn.microsoft.com/windowsapps/Web-Authentication-d0485122
I have not modified anything, just put in my "Consumer Secret" and "Consumer Key" all I get is "Cannot connect to the service." Other code examples give me 401 errors. Any ideas?
It takes time for the Twitter servers to globally register a Ouath key across all their servers.
It works now.. same consumer key / consumer secret, same example, it just work now.