Am implementing a restful api with yii2 and i would like to know how to expire a user's access token
In my login controller
if($model->login()){
return [
"access_token' => Yii::$app->user->identity->getAuthKey(),
];
}
Now in my other controllers am implementing this behaviour
class DefaultController extends Controller {
$behaviors['authenticator'] = [
'class' => CompositeAuth::className(),
'authMethods' => [
QueryParamAuth::className(),
],
];
}
Which works whenever iu send my request with access-token in my url
But now the problem is that the access token doesnt expire
How do i set the expiry time of the access token?