Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHardik Pansuria
1,449 PointsYelp doesn't OAuth token url anymore
To authenticate API calls with the API Key, set the Authorization HTTP header value as Bearer API_KEY. how to implement this instead of token url
1 Answer
Nathan F.
30,773 PointsHi Hardik, here's a simple implementation that you can adjust to your needs. You can get your API token from the 'Manage App' section of Yelp Developer's site. Pasan's aware of this change and there will likely be an update to reflect this soon.
let apiToken = "veryLongSecretAPIToken"
let bearerString = "Bearer \(apiToken)"
let endpointURL = URL(string: "https://api.yelp.com/v3/businesses/someBusiness")!
let yelpRequest = URLRequest(url: endpointURL)
yelpRequest.addValue(bearerString, forHTTPHeaderField: "Authorization")
Deysha Rivera
5,088 PointsDeysha Rivera
5,088 PointsThanks so much for this. Unfortunately, still no update to this video over a year later.