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

Need JavaScript example #51

Closed
mittonk opened this issue Jan 22, 2015 · 13 comments
Closed

Need JavaScript example #51

mittonk opened this issue Jan 22, 2015 · 13 comments

Comments

@mittonk
Copy link
Contributor

mittonk commented Jan 22, 2015

We used to have a JS example, but it was removed for security reasons in #17 .

We should have a JS example that doesn't expose OAuth credentials as publicly. Doesn't need to be super-high-security, but shouldn't be downright dangerous to emulate.

I wonder if Node.js or something similar might be close enough to fill this niche?

@tomelm
Copy link
Contributor

tomelm commented Oct 14, 2015

Since node.js is server-side the same design principles wouldn't apply (as far as making requests without exposing credentials).

Would we want to focus on client-side or server-side here?

@mittonk
Copy link
Contributor Author

mittonk commented Oct 15, 2015

Most of the interest I've seen is client-side; I don't have any particularly relevant quotes handy.

@meydman
Copy link

meydman commented Feb 3, 2016

I am trying to create a client side call to Yelp API, but getting Access-Control-Allow-Origin error in response. I have tried various solutions, but no avail. It seems Yelp is not responding with this header. Does Yelp allow API calls from JS client?

@mittonk
Copy link
Contributor Author

mittonk commented Feb 4, 2016

@meydman : Not sure --- filed a separate issue #99 to discuss that aspect, we can debug over there.

Keeping this issue strictly about needing a JS example.

@watterso
Copy link
Contributor

As I answered in #99 , we do not provide the CORS headers necessary to use clientside js to directly make requests to the api. Would that mean this is no longer a goal?

@mittonk
Copy link
Contributor Author

mittonk commented Feb 22, 2016

We definitely want to have an example of doing client-side JS! That's this ticket.

We just haven't figured out a way to do so that doesn't involve leveraging a separate server-side component (significant extra work), or putting all credentials in end-user-visible JS, etc.

@titocr
Copy link

titocr commented Mar 28, 2016

This answer on Stackoverflow might be useful to you. Note that your secret keys will be exposed here, but it is good for prototyping and playing around with the api.

@marcus-ko
Copy link

I see that a node-yelp-api libarary has been created: https://www.npmjs.com/package/node-yelp-api. But I don't know how to make use of this. Is this more secure? Any examples of using this would be appreciated.

@mittonk
Copy link
Contributor Author

mittonk commented Oct 26, 2016

@marcusk71 : That Node package requires server-side code.

@connor11528
Copy link

Okay for sure. Opened an issue on the node-yelp repo. In order to yelp api you need to make request from a server not a browser. It sounds like there is no way to get past this CORS error using client side code

Thank you!

olalonde/node-yelp#25

@caraya
Copy link

caraya commented Feb 5, 2017

JSONP may be a good idea to get around CORS restrictions. I'm experimenting to see if I can come up with something that makes sense

@builderLabs
Copy link

builderLabs commented Jun 22, 2017

Hello,

I've recently had to tackle this task and put my notes on it together - you might find my write-up useful.

I've just posted it, you can find it here:

Yelp Fusion JavaScript

Hope you find it useful.

@dan98765
Copy link
Contributor

We are in the process of archiving this API v2 github repository, and as part of that are closing out all issues.


Announcement:
As of June 30, 2018, the API v2 has been discontinued and v2 endpoints no longer work. It has been replaced by Yelp's Fusion API. This github repository is archived. There is a new Yelp Fusion-specific github repository at https://github.com/Yelp/yelp-fusion.

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

10 participants