Using Proximity API

617 Views Asked by At

I purchased an Eddystone beacon from RadiusNetworks. I am trying to follow this tutorial to register my beacon. But, I keep getting 401 auth error. Is there another step-by-step tutorial on proximity api?

Attaching Postman screenshot enter image description here

2

There are 2 best solutions below

4
On

You'll need to generate and pass in an OAuth token with your request. See https://developers.google.com/beacons/proximity/how-tos/authorizing for information on this.

In short though you need to add the Proximity API to your developer console, generate an OAuth credential and then use that to generate a token. How you do this differs a lot on your language of choice.

Finally once you have the token you need to pass it in with your request. This can be done using access_token parameter on the querystring or using the "Bearer" HTTP request header.

0
On

I might be late but it is for people who might need help in future.

  1. You need to create a project or use already created one at https://console.developers.google.com
  2. Go to dashboard, click Enable APIS and Services and enable Google proximity API
  3. Then go to credentials create credentials (I am assuming you will need it for web) Create credentials - > Create API Key (It can be unrestricted no issue). Once Created then again Create credentials->OAuth client ID (Create it for Web Application).

    Once you have both OAUTH and API key open Postman to test.

  4. In postman after putting the url you are testing, go to authentication tab of postman Change type to OAuth 2.0 Add authorization data to - > Request Headers Get Access Token Token Name:Token Name

    Grant Type:Authorization Code

    CallbackURL:https://developers.google.com/oauth2callback

    AuthURL:https://accounts.google.com/o/oauth2/auth

    Access TokenURL:https://accounts.google.com/o/oauth2/token

    ClientID:Your OAuth client ID

    Client Secret: OAuth client Secret

    Scope:https://www.googleapis.com/auth/userlocation.beacon.registry

    Client Authentication:Send as basic auth header and you are done i hope it helps :)