php 来自 Abraham 的 twitteroauth 在获取 auth url 用于用户身份验证时错误代码 32

php twitteroauth from Abraham error code 32 at getting aouth url for user authenticating

我想获取用户身份验证访问令牌以访问他的个人资料信息。当我 运行 脚本抛出以下错误时

Fatal error: Uncaught exception 'Abraham\TwitterOAuth\TwitterOAuthException' with message '{"errors":[{"code":32,"message":"Could not authenticate you."}]}' in C:\xampp\htdocs\promo\app\twitteroauth\src\TwitterOAuth.php:138

我的代码是

 $twitteroauth = new TwitterOAuth($config['consumer_key'], 
 $config['consumer_secret']); 
 //request token of application
 $request_token = $twitteroauth->oauth(
    'oauth/request_token', [
'oauth_callback' => $config['url_callback']
    ]
 );
 // throw exception if something gone wrong
 if ($twitteroauth->getLastHttpCode() != 200) {
 throw new \Exception('There was a problem performing this request');
 }
 // save token of application to session
 $_SESSION['oauth_token'] = $request_token['oauth_token'];
 $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
 // generate the URL to make request to authorize our application
 $url = $twitteroauth->url(
    'oauth/authorize', [
'oauth_token' => $request_token['oauth_token']
    ]
 );
 // and redirect
 header('Location: ' . $url);

请告诉我如何解决该错误。根据我的发现,当以下函数通过上述异常调用它时。

// request token of application
$request_token = $twitteroauth->oauth(
    'oauth/request_token', [
'oauth_callback' => $config['url_callback']
    ]
 );

我设置了 Twitter 应用程序的重定向 url,这解决了我的代码 32

问题