Api authorisation

Closes #63 
On trying to do this I'm facing some difficulty due to the `yield` keyword. I have to create a new generator to use this and then handle the generator. I'm not how to do this cleanly. Any ideas or should we leave it as is for the time being? I could make this a promise returning function but then again I think it will get messy due to the generators.