重定向到 Twitter 授权 URL 时出错

问题描述 投票:0回答:0

我正在尝试使用 tweepy 授权我的应用程序。但是当重定向到授权 url 时,我看到这样的 Twitter 页面:

“无法授予对应用程序的访问权限。请尝试返回并重新登录。”

和这样的错误:

oauthlib.oauth2.rfc6749.errors.MissingCodeError: (missing_code)

Missing code parameter in response.


我用的是OAuth2.0;

oauth2_user_handler = tweepy.OAuth2UserHandler(
    client_id=oauth_id,
    redirect_uri=callback_url,
    scope=["tweet.post", "tweet.read", "tweet.write", "users.read", "follows.read", "follows.write", "like.read", "like.write", "offline.access"],
    client_secret=oauth_secret
    )

auth_link = oauth2_user_handler.get_authorization_url()

我的

authorization url
是这样的:https://twitter.com/i/oauth2/authorize?response_type=code&client_id=Q0ZxT3FyMzFsWlFHWkNoNHc5QjM6MTpjaQ&redirect_uri=https%3A%2F%2Fd7db-212-252-142-151.ngrok-free .app%2Fcallback&scope=tweet.post+tweet.read+tweet.write+users.read+follows.read+follows.write+like.read+like.write+offline.access&state=a0smv3ENkUJVcisbJNwnwuMf585N36&code_challenge=sNDSO0EWOR9pjN5vwRfhA59O2v28GRPlalngelengelengemethon_chodA7vm =S256

为什么我无法正常访问授权页面?

api twitter oauth tweepy twitter-oauth
© www.soinside.com 2019 - 2024. All rights reserved.