问题描述
我对此深感困惑:
@bp.route('/api/spotify_auth')
def api_spotify_auth():
code = request.args.get("code",None)
error = request.args.get("error",None)
state = request.args.get("state").strip("\"'")
if state not in Spotify.valid_states:
return jsonify({
"error": "State returned was not valid","states": Spotify.valid_states,"state": state,"check": state in Spotify.valid_states
}),500
我希望该调用包含一个state
参数,该参数先前已添加到列表Spotify.valid_states
中。但是,当请求路线时,我得到:
{
"check": false,"error": "State returned was not valid","state": "07fec2ea-123f-42e8-9e64-07026ca87ae5","states": [
"07fec2ea-123f-42e8-9e64-07026ca87ae5"
]
}
很明显,python将false
返回到state in states
...但是在我看来,这应该返回true
。
有人提到引起问题的引号,因此.strip("\"'")
,但是问题仍然存在。
任何建议表示赞赏:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)