Python 查找无效的URI
大家好,我正在与Flask Dance合作,通过Spotify对用户进行身份验证。我已经在我的应用程序中正确列出了uri,但在登录后仍然会出现错误。网页显示无效\u客户端:无效重定向URI 代码如下:Python 查找无效的URI,python,flask,oauth,spotify,flask-dance,Python,Flask,Oauth,Spotify,Flask Dance,大家好,我正在与Flask Dance合作,通过Spotify对用户进行身份验证。我已经在我的应用程序中正确列出了uri,但在登录后仍然会出现错误。网页显示无效\u客户端:无效重定向URI 代码如下: from flask import Flask, redirect, url_for from flask_dance.contrib.spotify import make_spotify_blueprint, spotify app = Flask(__name__) app.secret
from flask import Flask, redirect, url_for
from flask_dance.contrib.spotify import make_spotify_blueprint, spotify
app = Flask(__name__)
app.secret_key = "supersekrit"
spotify_blueprint = make_spotify_blueprint(
client_id="myappid", client_secret="myappsecret", scope=["user-follow-read"])
app.register_blueprint(spotify_blueprint, url_prefix="/spotify_login")
@app.route('/')
def hello_world():
data = spotify.get("v1/me/following?type=artist")
if data.ok:
return data.json()
else:
return "Hello World Hope"
@app.route('/spotify')
def spotify_login():
if not spotify.authorized:
return redirect(url_for("spotify.login"))
data = spotify.get("v1/me/following?type=artist")
if data.ok:
return data.json()
else:
return "Bad Data"
if __name__ == "__main__":
app.run(debug=True)
这是我在应用程序中注册的重定向uri