Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

TOKEN_MISSING #184

Closed
rahuls2704 opened this issue Jan 16, 2017 · 8 comments
Closed

TOKEN_MISSING #184

rahuls2704 opened this issue Jan 16, 2017 · 8 comments

Comments

@rahuls2704
Copy link

I try to retrieve some information from Yelp API for a UWP app. As they say here, I need to pass some parameter as header for a HTTP request, and then perform a Json request using this link. I know how to parse a Json file once I get it, but I have no idea how to get access to this file.

If for example I put

https://api.yelp.com/v3/businesses/search?term=delis&latitude=37.786882&longitude=-122.399972&access_token=my%20access_tokenid

this link on my browser

and I am getting error that token_missing.

{"error": {"description": "An access token must be supplied in order to use this endpoint.", "code": "TOKEN_MISSING"}}

How should I enter this TOKEN_MISSING?

Also i got some answer Yelp/yelp-fusion#45 (comment).

but not get any help.

@mittonk
Copy link
Contributor

mittonk commented Jan 16, 2017

@rahuls2704 : Check out https://www.yelp.com/developers/documentation/v3/get_started .

First, follow "Get an access token" to use POST api.yelp.com/oath2/token with your App ID and App Secret to get an access token.

Next, include that access token in the "Authorization" header:

Header Name ("Key" in Postman) Header Value ("Value" in Postman)
Authorization Bearer MY_TOKEN

How you specify a header depends on what program you're using to make the GET request.
If you're using Postman, use the Headers tab; for curl use -H, etc.

Does that help? If so, we'll put more of this explanation up on the main docs.

(Side note: https://github.com/Yelp/yelp-fusion is the Github repo for the newer Fusion API your'e using; this https://github.com/Yelp/yelp-api/ is for the older V2 API.)

@rahuls2704
Copy link
Author

Thanks for your response, but not getting any success.

//**********//
Check out https://www.yelp.com/developers/documentation/v3/get_started .

First, follow "Get an access token" to use POST api.yelp.com/oath2/token with your App ID and App Secret to get an access token.
//**********//
I'm not getting the above point. please explained in detail. Thanks in advance.

@mittonk
Copy link
Contributor

mittonk commented Jan 17, 2017

@rahuls2704 : Are you using Postman, curl, or something else to make your request? I can try to use the words your tool uses.

Do you know how to make a POST request? It's not easy to do manually in a web browser, so most people use either Postman or curl. If you're just starting out I'd suggest Postman:

We've set up a list of our URLs in Postman's config format, so you don't have to type them in:

  1. Click "Postman for Chrome."
  2. In the left bar, click "Collections".
  3. Click "POST https://api.yelp.com/oauth2/token"
  4. Click "Body".
  5. On the line "client_id", replace "value" with your "App ID" from https://www.yelp.com/developers/v3/manage_app (22 characters long).
  6. On the line "client_secret", replace "value" with your "App Secret" from https://www.yelp.com/developers/v3/manage_app . (64 characters long, you'll need to click "Show" to see it behind the "*****").
  7. On the line "grant type", leave "client_credentials" as-is.
  8. Click the big blue "Send" button.
  9. In the "Response" field, you should see something like:
{
  "access_token": "MY_TOKEN",
  "token_type": "bearer",
  "expires_in": 15552000
}

The access token will be 128 characters long.

Let me know when you've gotten that far, and we'll do the next step --- but don't reveal your actual access token on the internet!

@rahuls2704
Copy link
Author

rahuls2704 commented Jan 18, 2017 via email

@mittonk
Copy link
Contributor

mittonk commented Jan 18, 2017

@rahuls2704 : Great, that's the first step.

Now, for the /v3/business/search request: Do not put your "access_token" in the URL. It needs to go in a Header instead.

  1. If you're using Postman, click the "Headers" tab (https://www.getpostman.com/docs/requests#headers), and add:
Header Name ("Key" in Postman) Header Value ("Value" in Postman)
Authorization Bearer MY_TOKEN
  1. If you're using curl:
curl -H "Authorization: Bearer MY_TOKEN" "https://api.yelp.com/v3/businesses/search?term=delis&latitude=37.786882&longitude=-122.399972"

(You can read more about HTTP headers in https://en.wikipedia.org/wiki/List_of_HTTP_header_fields , but we only need one of them today.)

@rahuls2704
Copy link
Author

Really Great Support from your site. Thanks a lot. You save me lots of time. Thanks a bunch of tone.

@mittonk
Copy link
Contributor

mittonk commented Jan 19, 2017

@rahuls2704 : Wonderful! If you have any more questions, head over to

and good luck!

@mittonk mittonk closed this as completed Jan 19, 2017
@khoick245
Copy link

Could you make the Java example for this, sir? I understand the Java v2 sample, but when I try to do with v3, I got stuck at this step {"error": {"description": "An access token must be supplied in order
to use this endpoint.", "code": "TOKEN_MISSING"}}.
I tried to change the key and token from Java v2 file into like this:
screen shot 2017-02-16 at 6 07 06 pm

And change the TwoStepOAuth file into like this:
screen shot 2017-02-16 at 6 09 28 pm

Sorry for the question cuz I'm not good with the documentation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants