1

I am implementing rest api in my laravel project. I want to save the access token which i got from the api response in session. When i tried this code, postman shows this error: Session store not set on request

<?php

  namespace App;

  use Illuminate\Http\Request;

  class AuthSession{


private $oAuthHeader;

private $request;

public function __construct(Request $request)
{

    $this->oAuthHeader = [];
    $this->request = $request;
}


/**
 * @return string
 */
public function getAccessToken()
{
    if($this->request->session()->has('accessToken'))
        echo $this->request->session()->get('accessToken');
    else
        return null;
}

/**
 * @param string $accessToken
 * @return AuthSession
 */
public function setAccessToken($accessToken)
{
    $this->request->session()->put('accessToken',$accessToken);
    return $this;
}
}
Zammuuz
  • 708
  • 4
  • 18
  • 43

0 Answers0