How to implement Yii2 remember me feature on app that uses OAuth access token?

I have Yii2 app that uses HTTP API with OAuth2. In the app config, I stored access key and secret key. I want the app to have a remember me feature.

The authentication part for the login form is done by using password credential, e.g. something like this


    curl -XPOST https://oauth.example.com/token 

         --data grant_type=password 

         --data username=USERNAME 

         --data password=PASSWORD



And getting the user profile for Identity is by calling an endpoint /profile using acccessToken returned by above endpoint.

My question is how should I build the remember me feature based on the flow above?

Since the user ID for the Yii::$app->user->id is returned by /profile using personalized access token and there is no endpoint to provide personal info based on the user ID, the \yii\web\IdentityInterface::findIdentity($id) can not be used. And since I use the \yii\web\User::loginByAccessToken(), there seems to be no way to set the duration like \yii\web\User::login().

(This is also posted on StackOverflow http://stackoverflow.com/questions/33079722/how-to-implement-yii2-remember-me-feature-on-app-that-uses-oauth-access-token)