Javascript Chrome扩展的Tumblr/Oauth问题,无法获取访问令牌
我正在开发一个Chrome扩展,它使用,将屏幕截图发布到我的特定Tumblr站点。我使用Oauth来实现这一点,但是在从Tumblr获取访问令牌时遇到了一些问题 授权过程的第一部分似乎正在工作,但随后就失败了。我看过其他一些涉及同样事情的帖子,但我不知道我做错了什么 manifest.json看起来像这样Javascript Chrome扩展的Tumblr/Oauth问题,无法获取访问令牌,javascript,google-chrome,google-chrome-extension,oauth,tumblr,Javascript,Google Chrome,Google Chrome Extension,Oauth,Tumblr,我正在开发一个Chrome扩展,它使用,将屏幕截图发布到我的特定Tumblr站点。我使用Oauth来实现这一点,但是在从Tumblr获取访问令牌时遇到了一些问题 授权过程的第一部分似乎正在工作,但随后就失败了。我看过其他一些涉及同样事情的帖子,但我不知道我做错了什么 manifest.json看起来像这样 { "manifest_version": 2, "name": "Black Sand White Sand Grey Sand", "description": "An ex
{
"manifest_version": 2,
"name": "Black Sand White Sand Grey Sand",
"description": "An extension for art",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_title": "Click on this I dare you!"
},
"background": {
"page": "background.html"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["blurry.css"],
"js": ["jquery-2.2.3.min.js", "script.js"]
}
],
"permissions": [
"alarms",
"activeTab",
"tabs",
"https://www.tumblr.com/oauth/request_token",
"https://www.tumblr.com/oauth/authorize",
"https://www.tumblr.com/oauth/access_token",
"http://black-sand-white-sand-grey-sand.tumblr.com/",
"<all_urls>"
],
"web_accessible_resources": [
"chrome_ex_oauth.html"
]
}
初始授权有效,会弹出一个请求访问的选项卡,但当我单击“允许”时,它会卡在另一个重定向页面上,在控制台中,它会给我这些错误
GET https://www.tumblr.com/oauth/access_token?oauth_consumer_key=z0lAIsL6mGl4Ib…h_token=H3x59WDyfwf9xacNrHVk9mLhVncRD0gnmdiJcnjyZXhsxY1gal&oauth_verifier= 400 (Bad Request)
Uncaught Error: Fetching access token failed with status 400
我还认为可能是下面的chrome_ex_oauth.html,但我不知道。在过去的几天里,我一直在尝试调整它,想办法解决它,但无法解决它。任何帮助都将不胜感激
<!DOCTYPE html>
<!--
* Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
<title>OAuth Redirect Page</title>
<style type="text/css">
body {
font: 16px Arial;
color: #333;
}
</style>
<script type="text/javascript" src="chrome_ex_oauthsimple.js"></script>
<script type="text/javascript" src="chrome_ex_oauth.js"></script>
<script type="text/javascript" src="onload.js"></script>
</head>
<body>
Redirecting...
</body>
</html>
OAuth重定向页面
身体{
字体:16px Arial;
颜色:#333;
}
重定向。。。
在GET/oauth/access\u令牌
请求中,oauth\u验证器
查询参数是否为空?这肯定会导致它失败,出现400
。你也能从tumblr获得准确的响应体,并通过400
返回吗?@mitchellcliftonbarton你找到解决方案了吗?我也犯了同样的错误?@Shailajashah不,我从来没有犯过!棘手的问题
<!DOCTYPE html>
<!--
* Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
<title>OAuth Redirect Page</title>
<style type="text/css">
body {
font: 16px Arial;
color: #333;
}
</style>
<script type="text/javascript" src="chrome_ex_oauthsimple.js"></script>
<script type="text/javascript" src="chrome_ex_oauth.js"></script>
<script type="text/javascript" src="onload.js"></script>
</head>
<body>
Redirecting...
</body>
</html>