错误:redirect_uri_mismatch :: redirect_uri必须匹配注册的回调URL(error : redirect_uri_mismatch :: The redirect_uri MUST match the registered callback URL)
所以我正在尝试使用Github OAuth API在Flask中学习OAuth,并且我正在使用
flask_dance
库。 我能够在Github上对自己进行身份验证,然后返回到我的应用程序,但显示404 Not Found Error
和url中的http://localhost:5000/login/authorized?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application...
,回调网址似乎是正确的,因为它是我在github上给出的,但仍然显示redirect_uri mismatch
。 我在这里阅读文档,并知道我们可以从请求中删除redirect_uri
参数,但我不知道该怎么做。 (我在Windows 10上)
你能帮忙的话,我会很高兴。 谢谢。App.py
from flask import Flask, redirect, url_for from werkzeug.contrib.fixers import ProxyFix from flask_dance.contrib.github import make_github_blueprint, github app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_app) app.secret_key = "supersekrit" blueprint = make_github_blueprint( client_id="xxxxxxxxx", client_secret="xxxxxxxx", ) app.register_blueprint(blueprint, url_prefix="/login") @app.route("/signup") def index(): if not github.authorized: return redirect(url_for("github.login")) resp = github.get("/user") assert resp.ok return "You are @{login} on GitHub".format(login=resp.json()["login"]) if __name__ == "__main__": app.run(debug=True)
So I am trying to learn OAuth in Flask using Github OAuth API and I am using
flask_dance
library for it. I am able to authenticate myself on Github and return back to my app but in its showing404 Not Found Error
and in the url itshttp://localhost:5000/login/authorized?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application...
, The callback url seems correct as it is what I gave on github but still its showingredirect_uri mismatch
. I was reading the documentation here and got to know that we can removeredirect_uri
parameter from the request but I am not sure how to do that. ( and I am on Windows 10 )
Any help would be nice. Thanks.App.py
from flask import Flask, redirect, url_for from werkzeug.contrib.fixers import ProxyFix from flask_dance.contrib.github import make_github_blueprint, github app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_app) app.secret_key = "supersekrit" blueprint = make_github_blueprint( client_id="xxxxxxxxx", client_secret="xxxxxxxx", ) app.register_blueprint(blueprint, url_prefix="/login") @app.route("/signup") def index(): if not github.authorized: return redirect(url_for("github.login")) resp = github.get("/user") assert resp.ok return "You are @{login} on GitHub".format(login=resp.json()["login"]) if __name__ == "__main__": app.run(debug=True)
原文:https://stackoverflow.com/questions/49592599
最满意答案
假设您的第一个查询返回单个结果,那么这应该工作:
DELETE p FROM possessions p INNER JOIN goods_meta_data gmd ON p.good_id = gmd.id INNER JOIN cities c ON c.name = 'St Charles' WHERE p.day_created < c.day - gmd.durability
Assuming your first query returns a single result, then this should work:
DELETE p FROM possessions p INNER JOIN goods_meta_data gmd ON p.good_id = gmd.id INNER JOIN cities c ON c.name = 'St Charles' WHERE p.day_created < c.day - gmd.durability
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
MySQL:查询优化(MySQL: Query Optimization)[2023-01-04]
用JOIN子句替换你的嵌套选择。 以此为例: AND a.FundIDRecv IN ( SELECT FundIDRecv FROM tbl_FundSubscriptions WHERE FundIDSend IN ( SELECT FundID FROM tbl_FundStatic WHERE UserID = '14' ) ) 为什么不把tbl_FundStatic连接到这样的外部查询呢? FROM tbl_Fund ... -
复杂的查询优化(Complex Query Optimization)[2022-12-18]
尝试更改最后一条语句,因为查询将评估所有这些语句。 然后检查是否等于1,你应该尝试和“OR”语句,因为如果一个是正确的,它就不会评估其他的选择。 它应该会对你有所帮助。 像这样的东西。 AND ( SUBSTRING(s."Field ID" FROM 0 FOR 3) = '01' OR SUBSTRING(s."Field ID" FROM 0 FOR 4) = '321' OR SUBSTRING(s."Field ID" FROM 0 FOR 5) = '1234' OR S ... -
优化一个mysql查询(Optimization of a mysql query)[2022-03-11]
如果你不能改变表格(存储单独的日期会有所帮助),那么只有索引,那么: 创建一个复合索引: carrier, reg_date ,然后组合carrier, reg_date和order by reg_date, carrier 。 您可以为时间戳创建另一个索引(它可能对WHERE caluse更好,取决于范围之外的记录数)。 此外,您可以使用完全unix时间戳,然后将其作为子查询嵌入,外部可将时间戳转换为人类可读的日期(这种转换是在群组之后完成的,而不是针对每个单独的记录)。 创建索引: CREATE IND ... -
重复数据并非“糟糕”,并且不应“不惜一切代价”。 什么是“坏”是不受控制的冗余,以及当逻辑数据模型不是第三范式时出现的问题。 可以接受并预期实现将偏离逻辑数据模型,并为性能引入冗余。 您修改后的设计看起来适合您的需求。 Duplicated data is not "bad", and it's not to be "avoided at all cost". What is "bad" is uncontrolled redundancy, and the kind of problems that co ...
-
可以查询多个IP地址。 我们可以采取几种方法。 假设range_start和range_end被定义为整数类型。 对于合理数量的ip地址,我们可以使用内联视图: SELECT i.ip, a.* FROM ( SELECT 3232235520 AS ip UNION ALL SELECT 3232235521 UNION ALL SELECT 3232235522 UNION ALL SELECT 3232235523 ...
-
Mysql优化(Mysql optimization)[2023-04-13]
要尝试的事情: 有一个单独的date列(索引)并使用它而不是您的timestamp列 在type和date之间添加索引 使用BETWEEN(不要认为它会影响速度,但它更容易阅读) 理想情况下你会这么做 创建一个date列并使用UPDATE table SET date = DATE(timestamp)填充它UPDATE table SET date = DATE(timestamp) 跨type和date索引 将您的选择更改为... type =? 和约会? 和? Things to try: Have ... -
假设您的第一个查询返回单个结果,那么这应该工作: DELETE p FROM possessions p INNER JOIN goods_meta_data gmd ON p.good_id = gmd.id INNER JOIN cities c ON c.name = 'St Charles' WHERE p.day_created < c.day - gmd.durability Assuming your first query returns a single result ...
-
MySQL查询优化?(MySQL Query Optimization?)[2023-10-05]
我最终做的是混合了JRD,TZHX和MarcB的评论。 我最后做了一个没有时区的选择,但是增加了我的选择半径加减一天。 这让我的大约500万行下降到大约50,但是因为它比我想要的稍微多一点,然后我运行原始查询,但只对第一个选择返回的50个结果。 这导致返回所有完全相同的数据,但仅在0.11秒内。 非常感谢你们! What I ended up doing was a mix of JRD, TZHX, and MarcB's comments. I ended up doing a select witho ... -
假设你没有为coloumns建立索引,所以我为你的coloumns创建了一些索引,这对你有帮助,并且仍有很多coloumns索引,就像在你的连接条件中你应该对该coloumns应用这个操作也是为了更好的执行 ALTER TABLE `t_mmrrc_order` ADD INDEX `Indexnamemmrrc_order_oid` (`mmrrc_order_oid`); ALTER TABLE `t_mmrrc_order` ADD INDEX `Indexnamecompleted_by_email ...