草庐IT

ruby-on-rails - Google 跨客户端授权和 invalid_grant 错误

我目前正在开发用于GoogleApi跨客户端授权的Web组件,如本文所述。https://developers.google.com/identity/protocols/CrossClientAuth此外,我所处的环境是Rails,因此我正在使用本文中描述的google-api-clientgemhttps://developers.google.com/identity/protocols/OAuth2WebServer#handlingtheresponse授权代码是通过Android应用程序使用Web客户端ID获取的,并传递到WebAPI以进行交换。我使用gem和代码兑换如下a

javascript - 设置@grant值后如何访问 `window`(目标页面)对象?

假设我正在使用以下网页:clickmevarhello=function(){alert('hello');}document.getElementById('click').addEventListener('click',function(e){hello();});我的Greasemonkey脚本是://==UserScript==//@nameMyScript//@includehttp://example.com/hello.html//@version1//@grantnone//==/UserScript==window.hello=function(){alert('g

go - 使用 golang 在 google admin sdk api 上获取 400 invalid_grant。有什么建议么?

我正在尝试编写一个golang脚本,该脚本使用我的服务帐户来管理我的google域。当我尝试做一个简单的用户列表时出现错误:400invalid_grant。看来我正在正确使用我的服务帐户(?),而且我的服务帐户是super管理员。我在Java代码中使用凭据;所以我知道它是有效的。有什么想法吗?packagemainimport("fmt""io/ioutil""log""golang.org/x/net/context""golang.org/x/oauth2/google"directory"google.golang.org/api/admin/directory/v1")fun

Google Calendar API invalid_grant 获取 token (Golang)

我正在尝试检索访问token,以便使用Oauth2对用户进行身份验证。我主要使用在谷歌的HOW-TO页面上找到的代码,用于将CalendarAPI与golang结合使用。问题是每当我尝试获取token时,谷歌都会发回:Response:{"error":"invalid_grant"}出现错误oauth2:cannotfetchtoken:400BadRequest正如我所说,我正在使用从google的howto中获取的一些代码,只是稍作修改以满足我的需要。//Somewhere...authURL=config.AuthCodeURL("state-token",oauth2.Acc

php - Google OAuth2 错误 - 缺少必需参数 : grant_type on refresh

我已经使用Google日历API构建了一个原型(prototype)日历同步系统,它运行良好,除了刷新访问token。这些是我完成的步骤:1)授权我的API并收到授权码。2)交换了访问token和RefreshToken的授权代码。3)在访问token过期之前使用日历API。此时我尝试使用刷新token获取另一个访问token,因此我的用户不必继续授予访问权限,因为日记同步发生在他们离线时。这是PHP代码,我在整个系统中使用curl请求。$requestURL="https://accounts.google.com/o/oauth2/token";$postData=array("g

php - Sage One API - unsupported_grant_type

我正在尝试按照docs获取SageOneAPI的访问token使用Guzzle(v6)/Laravel5.2(Laravel的参与与本题无关),卡在“请求访问token”阶段。错误Clienterror:`POSThttps://api.sageone.com/oauth2/token`resultedina`400BadRequest`response:{"error":"unsupported_grant_type"}违规代码$client=newClient(['base_uri'=>'https://api.sageone.com','headers'=>['content_t

php - Laravel 5.4 护照 : unsupported_grant_type

您好,我尝试做一个Web应用程序,但遇到了问题。当我从/oauth/token请求token时,我收到此响应:{"error":"unsupported_grant_type","message":"Theauthorizationgranttypeisnotsupportedbytheauthorizationserver.","hint":"Checkthe`grant_type`parameter"}我的代码是:import{Injectable}from'@angular/core';import{Http,Response,RequestOptions,Headers}fro

php - 谷歌 API OAuth 2.0 CURL 返回 "Required parameter is missing: grant_type"

我正在尝试为Web服务器应用程序实现Google的OAuth2.0身份验证。我可以从Google获取代码,但是当我发回此代码以尝试获取访问token时,它总是给我错误“缺少必需的参数:grant_type。错误400”,即使grant_type存在。此外,如果我将内容长度指定为0以外的任何值,它会引发其他错误。这是执行此curl帖子的代码:$url='https://accounts.google.com/o/oauth2/token';$ch=curl_init($url);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setop

php - 谷歌服务帐户示例返回 "Error refreshing the OAuth2 token { “error” : “invalid_grant” }"

我的目标是代表我的网络应用程序用户在GoogleFusionTables上进行最简单的查询。为此,我在Google控制台上创建了一个服务帐户。这是代码://Creatingagoogleclient$client=new\Google_Client();//settingtheserviceacountcredentials$serviceAccountName='XXXXX.apps.googleusercontent.com';$scopes=array('https://www.googleapis.com/auth/fusiontables','https://www.goog

php - 从亚马逊获取 "The authorization grant type is not supported by the authorization server"

我正在尝试获取访问token,但是我收到了这个错误{"error_description":"授权服务器不支持授权授予类型","error":"unsupported_grant_type"}$code=$_GET['code'];$postfields=array('grant_type'=>'authorization_code','code'=>$code,'redirect_uri='=>'example/myTest.php','client_id'=>'amzn1.application-oa2-client.xxxxxxxxxxx','client_secret'=>'x