commerceguys / guzzle-oauth2-plugin

Provides an OAuth2 plugin (subscriber) for Guzzle
MIT License
123 stars 71 forks source link

Access Token caching #15

Open AV4TAr opened 9 years ago

AV4TAr commented 9 years ago

Hi guys, is there a way to cache the access token, so that It does not need to get it on every request?

pjcdawkins commented 9 years ago

It's not directly part of this library, at the moment, but yes you can and should save the access token (and ideally a refresh token) for later re-use.

I am using a mobile right now so I can't easily give an example but here's a link to an implementation:

https://github.com/platformsh/platformsh-client-php/blob/development/src/Connection/Connector.php

It should be possible to generalise this I guess, although I imagine there are many different ways in which people will want to store tokens depending on the use case.