Now that we have all the work done at the API level we need to adjust the frontend to store the access token once we log in to the app and pass the access token along with the request while accessing the API. We will also set up the expiration on the containers of the session because the token has expiration.
As this is the centralized point for all the API requests, this is the only place where we need to send the access token to the API. We need to first import the Container
component by using the following code to access the sessions we are using to store the access token:
useZend\Session\Container;
After that, we will create a new property using the following code to store the session object to avoid creating it over and over again:
protected static $session = null;
Then we need to create the following method to retrieve the Container
object:
public static function getSession() { if (self::$session === null) { self::$session = new Container('oauth_session...