Login not persistent

I want to login a user through data received from an API.

currently, I have an API ENDPOINT the gives me a user token or error on user login detail submission.

by posting the token to another endpoint I get back the user Profile.

now I need that user profile to be persistent throughout the app as long as the token is valid.

but if I call

Yii::$app->user->login( $profile, 3600*24*7 );
the following code

Yii::$app->user->isGuest

return false only within the Auth controller . for another controller it always returns true. and I am not able to access the profile data through

Yii::$app->user->identity

any help or maybe another better way of getting this done will be extremely appreciated.