Heimdallr.swift icon indicating copy to clipboard operation
Heimdallr.swift copied to clipboard

New built-in OAuth Access Token Store: iCloud Key-Value Storage

Open fabiomassimo opened this issue 8 years ago • 1 comments

Summary

Added a new OAuth Access Token Store base on iCloud Key-Value Storage.

Why

I wanted to have the opportunity to store access token information in a shared container accessible from other devices that do not have capabilities to support the OAuth 2 authentication process (like tvOS). By using this new built in store, the user can rely on the iCloud Key-Value Storage, connected to his personal iCloud account, to share authentication information retreived from other devices.

Notes

  1. I'm not sure how to write tests for this feature. The new class I created his heavily coupled with a valid iCloud Key-Value Storage. Any idea?

  2. It would be nice to improve the OAuthAccessTokenStore protocol with a proper callback method that notifies when a new access token has been set. Currently, if new information have been sent from another device, the user has to manually query the iCloud Key-Value Store again to retrieve new information.

fabiomassimo avatar Jun 05 '16 22:06 fabiomassimo

Hi and thanks for your contribution!

I had a look and I think this is definitely the right way to go!

Regarding testing I would try the following: Inject the store as a dependency, so that you can mock that out in test (via Dobby). And then you could verify, that the expected methods on the store get called.

Regarding the OAuthAccessTokenStore protocol: Can you sketch out/show/code up what you have in mind?

hffmnn avatar Jun 22 '16 08:06 hffmnn