Dealing with Deprecation & iOS Headers

robotsquidward

A.J. Kueterman

Posted on February 5, 2020

Dealing with Deprecation & iOS Headers

Recently, I started getting emails from GitHub letting me know that my GitHub OAuth app was accessing GitHub API's using a deprecated authentication method.

My app, OctoNote, uses the GitHub gists API to store and manage notes as GitHub gists. I had originally set up OAuth for OctoNote using an access_token as a URL query parameter, which is no longer supported.

Instead, we need to add the token as an Authorization header on the request. Doing so in iOS is easy, just specify the value of the token and the name of the Header field (in this case Authorization) on your API call requests.

request.setValue("token \(token_val)", forHTTPHeaderField: "Authorization")
Enter fullscreen mode Exit fullscreen mode

After doing this, your regular calls to the GitHub API's should still work as expected, but you should no longer get deprecation notices from GitHub! 🎉

💖 💪 🙅 🚩
robotsquidward
A.J. Kueterman

Posted on February 5, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related