Login only once

php

#1

i created a twitter app, i need it to only ask user to login/authenticate his account once, the first time only.
cause no user loves to login his credentials every time he uses an app


#2

Yes - so implement the login with Twitter flow, and store the user token and secret after the user has authenticated. You can then re-use those values to operate on the user’s behalf until or unless the user revokes access to your app.


#3

i get invalid access token

["_accessToken":“yii\authclient\BaseOAuth”:private]=>
object(yii\authclient\OAuthToken)#121 (5) {
[“tokenParamKey”]=>
string(11) “oauth_token”
[“tokenSecretParamKey”]=>
string(18) “oauth_token_secret”
[“createTimestamp”]=>
int(1471879616)
["_expireDurationParamKey":“yii\authclient\OAuthToken”:private]=>
NULL
["_params":“yii\authclient\OAuthToken”:private]=>
array(5) {
[“oauth_token”]=>
string(50) “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
[“oauth_token_secret”]=>
string(45) “xxxxxxxxxxxxxxxxxxxxxxxxxx”
[“user_id”]=>
string(10) “xxxxxxxx”
[“screen_name”]=>
string(15) “xxxxxxxxxxxxxxxxxx”
[“x_auth_expires”]=>
string(1) “0”
}
}

i save both oauth_token and oauth_token_secret, when i send api call with access_token = oauth_token and access_token_secret = oauth_token_secret, i get invalid access token

$user_data = $client_new->api(“account/verify_credentials.json”, ‘GET’, [‘consumer_key’ => Yii::$app->params[‘consumerKey’], ‘consumer_secret’ => Yii::$app->params[‘consumerSecret’], ‘access_token’ => Yii::$app->params[‘accessToken’], ‘access_token_secret’ => Yii::$app->params[‘accessTokenSecret’]]);


#4

any help ?!