managedit/kohana-oauth2 — comment on commit b51aed23a99f417cc91afc7fc33ee91f869237c7
File: classes/kohana/oauth2/consumer.php line 51
By kiall:

The reason I do it internally is because the token can be changed out inside the class without the containing application ever knowing, leave the stored token out of date. (ie, when the refresh_token is exchanged for a fresh access_token)

Maybe we instead pass in a token storage class?

Something like:

OAuth2_Consumer::factory($provider, OAuth2_Consumer_TokenStore $store = NULL, array $token = NULL)

This would allow for OAuth2_Consumer_TokenStore_Cookie, OAuth2_Consumer_TokenStore_Session, OAuth2_Consumer_TokenStore_Database etc

This would also allow for Database style stores to be pre-populated with the user_id etc that might be needed before passing them into the constructor..

Thoughts?