Difference between #2 and #3 of
JWT authentication tutorial

Revision #3 has been created by Allan Jensen on Jun 21, 2021, 12:21:30 PM with the memo:

Check saving refresh token succeeds
« previous (#2) next (#4) »

Changes

Title unchanged

JWT authentication tutorial

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

authentication,auth,jwt

Content changed

[...]
'urf_token' => $refreshToken,
'urf_ip' => Yii::$app->request->userIP,
'urf_user_agent' => Yii::$app->request->userAgent,
'urf_created' => gmdate('Y-m-d H:i:s'),
]);
if (!$userRefreshToken->save();) {
 
throw new \yii\web\ServerErrorHttpException('Failed to save the refresh token: '. $userRefreshToken->getErrorSummary(true));
 
}


// Send the refresh-token to the user in a HttpOnly cookie that Javascript can never read and that's limited by path
Yii::$app->response->cookies->add(new \yii\web\Cookie([
'name' => 'refresh-token',
'value' => $refreshToken,
[...]
13 0
8 followers
Viewed: 163 828 times
Version: 2.0
Category: Tutorials
Written by: Allan Jensen
Last updated by: Allan Jensen
Created on: Jun 7, 2021
Last updated: 3 years ago
Update Article

Revisions

View all history