首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Uber oauth2.0登录重定向次数过多

Uber oauth2.0登录重定向次数过多
EN

Stack Overflow用户
提问于 2017-01-11 22:08:53
回答 1查看 1.3K关注 0票数 0

我正在尝试设置一个第三方服务,它使用Uber API来拉取客户历史记录。我已经运行了一个本地的Flask应用程序,它执行auth_flow并重定向到优步登录页面。输入正确的凭据后,重定向似乎永远不会结束,因此在发布的图像中出现错误。

代码语言:javascript
运行
复制
import os
from datetime import datetime
from flask import Flask, request, flash, url_for, redirect, \
     render_template, abort, send_from_directory, redirect
from uber_rides.auth import AuthorizationCodeGrant

app = Flask(__name__)
app.config.from_pyfile('flaskapp.cfg')

# Configure Uber Oauth2.0
auth_flow = AuthorizationCodeGrant(
    '<client_id>',
    'history',
    '<client_secret>',
    'http://localhost:8080'
    )

@app.route('/')
def index():
    auth_url = auth_flow.get_authorization_url()
    return redirect(auth_url, code=302)

if __name__ == '__main__':
    app.run(debug=True)

这是我的代码。在Uber developer仪表板中,我添加了http://localhost:8080作为重定向URI,并选中了scopes下的history选项。

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-11 23:23:50

我没有看到任何回调的路径...看起来是这样的:用户打开应用程序,被重定向到auth_url (我假设那是优步身份验证页面),用户授权你的应用程序,用户被重定向到http://localhost:8080。此重定向命中索引路由,用户返回到auth_url。用户第二次看到优步身份验证页面时,他的会话仍然有效,并被重定向回http://localhost:8080。这会创建一个永无止境的循环。

一种解决方案是将重定向URL设置为命中不同的回调路由,例如http://localhost:8080/callback

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41593088

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档