Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fabiomassimo
Copy link

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.

Fabio Milano added 4 commits June 5, 2016 23:32
…age. If in DEBUG configuration a proper exception is raised in case the synchronisation fails.
… iCloud Key-Value based access token store.

store.setDictionary(accessTokenDictionaryRepresentation, forKey: service)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the optional accessToken is nil?

@hffmnn
Copy link
Contributor

hffmnn commented Jun 22, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants