twitter - how to set the oauth_verifier in the header twitteroauth php -
i'm getting following error:
error processing oauth request: invalid oauth_verifier parameter
i keep reading issue in library twitteroauth abraham
need set oauth_verifier in header , not body.
i don't know how this.
here code:
// twitterlogin.php
session_start(); $twitterkey = 'xxx'; $twittersecret = 'xxx'; $callback = "https://xxx/socialmedia/twittercallback.php"; require_once("/xxx/twitteroauth/vendor/autoload.php"); use abraham\twitteroauth\twitteroauth; $twitter = new twitteroauth($twitterkey,$twittersecret); $result = $twitter->oauth('oauth/request_token', ['oauth_callback' => $callback]); $_session['oauth_token'] = $result['oauth_token']; $_session['oauth_token_secret'] = $result['oauth_token_secret']; $url = $twitter->url('oauth/authorize', array('oauth_token' => $result['oauth_token'])); header("location: $url");
// twittercallback.php
session_start(); require_once("/xxx/api"); $twitterkey = 'xxx'; $twittersecret = 'xxx'; require_once("/xxx/twitteroauth/vendor/autoload.php"); $twitter = new \abraham\twitteroauth\twitteroauth($twitterkey,$twittersecret,$_session['oauth_token'],$_session['oauth_token_secret']); try { $access_token = $twitter->oauth("oauth/access_token", ["oauth_verifier" => $_get['oauth_verifier']]); $_session['access_token'] = $access_token; } catch(\exception $e){ print "<pre>".print_r($e,true)."</pre>"; } var_dump($access_token);
how set oauth_verifier in header?
thanks!
Comments
Post a Comment