Background
My application is getting data from many different sources (APIs) and aggregating across them. So the user logs via OAuth2 into the source once and afterward I continuously make calls to the source.
I am using thephpleague/oauth2-client
to connect to different services, I also use provider packages build on top to connect to different websites. I have absolutely no issue there.
Once I authenticate I get an League\OAuth2\Client\Token\AccessToken
instance.
Current situation
Right now for storage, I do a json_encode
on the AccessToken
instance and store the resulting unstructured string
. To load it, I json_decode
and create a new instance via the constructor. Not really interesting.
The question
If I wanted to store the access token(the OAuth response in general) a structured way, what data would I need? What do I need to persist for server-to-server communication? The specific items and their types? I am trying to figure out the data model for storing many different providers.