Yahoo’s weather API – Open-source OAuth sample for Swift and Objective-C

Who doesn’t enjoy porting a piece of code from one language to another? It keeps you sane with multiple languages and their architecture.

Quite recently, Yahoo has changed the free API calls to the weather database to OAuth1.0 mechanism. We were using this free service in one of our apps and had to upgrade for the same.

Android apps were easily upgraded as Yahoo has provided the sample code in Java, Node.js and PHP but not in Swift/Objective-C.

We picked the JAVA code and ported it to Swift and Objective-C and since it was no where to be found, just to help out the open source community, created a Github repo for the same.

One head scratcher that we encountered was, while creating an HMAC-SHA1 encryption we need to append the “&” keyword to the consumer secret key and this is not mentioned anywhere on Yahoo’s sample code page explicitly.

If you need to read more about OAuth and its mechanism, you should read this: OAuthBible

If you want to generate HMAC-SHA1 signature, try this: Online HMAC Generator

Screen Shot 2019-01-22 at 2.28.48 PM

Leave a Reply

Your email address will not be published. Required fields are marked *


nine + = 17

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>