How to store twitter oauth details in mysql database?

萝らか妹 提交于 2019-12-25 05:07:08

问题


I am developing a basic twitter oauth app! Here's the code -

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
$oauth_token = $_GET['oauth_token'];
    if($oauth_token == '')
      { 
        $url = $twitterObj->getAuthorizationUrl();
        echo "<div style='width:200px;margin-top:200px;margin-left:auto;margin-  right:auto'>";
        echo "<a href='$url'>Sign In with Twitter</a>";
        echo "</div>";
     } 
    else
      {
        $twitterObj->setToken($_GET['oauth_token']);
        $token = $twitterObj->getAccessToken();
        $twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);     
        $_SESSION['ot'] = $token->oauth_token;
        $_SESSION['ots'] = $token->oauth_token_secret;
        $twitterInfo= $twitterObj->get_accountVerify_credentials();
        $twitterInfo->response;
        $username = $twitterInfo->screen_name;
        $profilepic = $twitterInfo->profile_image_url;
        include 'update.php';

     } 

so now tell me the coding process how can I save the user login details!


回答1:


Encrypt the auth token and its secret and store them in the database encrypted. See here for more information



来源:https://stackoverflow.com/questions/6161613/how-to-store-twitter-oauth-details-in-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!