google-beacon-platform

Getting 401 and 403 with Google Proximity API


I've set up a project for the beacon API from google, but every request I tried keeps getting a 401 (using a public key) or a 403 with the sample app enter link description here

The response says:

{ "error": { "code": 403, "message": "Project has not enabled the API. Please use Google Developers Console to activate the API for your project.", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.Help", "links": [ { "description": "Google developer console API activation", "url": "https://console.developers.google.com/project/608941808256/apiui/api" } ] } ] } }

but I already enabled the API.


Solution

  • You have to create an API-Key and a OAuthClient-ID getting-started and link them to you app. After creating those you have to restriced them to Android only and insert the package name com.google.sample.beaconservice for this expamle app. Further you need to insert the sha1-key. You can use the debug key generated by the command: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v

    An OAuthClient-Id will be enough for this sample app. Since it does not use the getforobserved Method, which would require the API-Key in the manifest.xml