Please tell how to set the values to the sub,exp,nbf,iat Utils::loadCurrentSession($headers, $_COOK

Please tell how to set the values to the sub,exp,nbf,iat Utils::loadCurrentSession($headers, $_COOK

achintha
Shopify Partner
5 0 0
Please some one help!

Please tell how to set the values to the sub,exp,nbf,iat elements in below code.

$payload = [
  'iss' => 'https://XXXXXXXXX.myshopify.com/admin',
  'dest' => 'https://XXXXXXXX.myshopify.com',
  'aud' => YOUR APP API KEY,
  'sub' => HOW SET THIS VALUE IN PHP,//<user ID
  'exp' => HOW SET THIS VALUE IN PHP,//time in seconds
  'nbf' => HOW SET THIS VALUE IN PHP,//time in seconds
  'iat' => HOW SET THIS VALUE IN PHP,//time in seconds
  'jti' => Uuid::uuid1(),
  'sid' => HOW SET THIS VALUE IN PHP
];
$jwt = JWT::encode($payload, 'YOUR APP SECRET KEY', 'HS256');

$headers['authorization'] = "Bearer " . $jwt;
$headers['api_version'] = config('shopify.apiVersion');
$currentSession = Utils::loadCurrentSession($headers, $_COOKIE, true);

echo $currentSession->getAccessToken();
Replies 0 (0)