带有双腿OAuth的Gmail原子Feed接收401错误 [英] Gmail atom feed with 2-legged OAuth receive 401 error

查看:139
本文介绍了带有双腿OAuth的Gmail原子Feed接收401错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们遇到了使用双腿OAuth的Gmail原子Feed问题,错误消息是401未授权。

错误消息如下所示。 / p>

< HTML>
< HEAD>
< TITLE>未经授权的< / title>
< / HEAD>
< BODY BGCOLOR =#FFFFFFTEXT =#000000>
< H1>未经授权< / H1>
< H2>错误401< / H2>
< / BODY>
< / HTML>

直到上周,我们使用Gmail atom feed没有任何问题。从本周开始,即使我们对Gmail原子提要和oauth没有改变,我们仍然遇到了这个问题。
现在,这个问题不会发生在所有用户(50,000个账户)上,但是这个问题越来越多。



看来这个问题是引起的由谷歌方面。



有没有人有同样的问题?



源代码如下所示。 p>

  private GoogleOAuthParameters mOauthParameters; 
私人OAuthSigner mSigner;

private final String SCOPE =https://mail.google.com/mail/feed/atom;

GoogleService服务;

String result = null;

mOauthParameters = new GoogleOAuthParameters();
mSigner = new OAuthHmacSha1Signer();

mOauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
mOauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);

service = new GoogleService(gmail,feed);
service.setOAuthCredentials(mOauthParameters,mSigner);
service.setConnectTimeout(timeOut);
service.setReadTimeout(timeOut * 5);

GDataRequest request = service.createFeedRequest(new URL(SCOPE +?xoauth_requestor_id =+ email));
request.execute();
InputStream是= null;

尝试{
is = request.getResponseStream();
StringBuffer out = new StringBuffer();
byte [] buffer = new byte [4094];
int readSize;
while((readSize = is.read(buffer))!= -1){
out.append(new String(buffer,0,readSize));
}
result = out.toString();
} catch(Exception e){
throw e;
} finally {
is.close();
}

我需要你的帮助。



请检查我们的源代码或其他样本是否使用了双腿OAuth的gmail atom feed。



问候。

解决方案

的确,这似乎是一个Google问题。
我建议您使用报告错误/提供反馈选项向Google报告。 菜单原子&安培; AUTH_CODE = 4 / gMHvI3lVmgZLjwuHcqDNXb9sgpAd.IlQXmNVDxqYYaDn_6y0ZQNjwSRSNjQI&安培; URL = HTTPS://mail.google.com/mail/feed/atom/& CONTENT_TYPE =应用/ JSON&安培; http_method = GET&安培; useDefaultOauthCred =未选中&安培; oauthEndpointSelect =谷歌&安培; oauthAuthEndpointValue = https://accounts.google.com/o/oauth2/auth&oauthTokenEndpointValue=https://accounts.google.com/o/oauth2/token&expires_in=3599&access_token_issue_date=1403490165&for_access_token=ya29.LgBhdvQCpnNiCh4AAACWKgOKeiEr2DLX1cO4gBlPRFvfzJK_Go82kGu3Mx9qYg&includeCredentials=未经检查和放大器; accessTokenType =承载和放大器; autoRefreshToken =选中&放大器;存取类型=在线&放大器; forceAprovalPrompt =检查和放大器; RESPONSE_TYPE = coderel =nofollow noreferrer> OAuth 2.0 Playground 或Gmail中的发送反馈选项,菜单)。


We are experiencing the issue of Gmail atom feed with 2-legged OAuth, an error message is "401 unauthorized".

The error message is like below.

<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

Until last week, we have no problem using Gmail atom feed. From this week, we are experiencing the issue even though we have a no change regarding Gmail atom feed and oauth. Now, this problem do not occurs on all users(50,000 accounts), but this issue is increasing more and more.

It seems that this problem is caused by Google's side.

Is there anyone who has same issue?

Source code is like below.

private GoogleOAuthParameters mOauthParameters; 
private OAuthSigner mSigner; 

private final String SCOPE = "https://mail.google.com/mail/feed/atom";

GoogleService service;

String result = null;

mOauthParameters = new GoogleOAuthParameters();
mSigner = new OAuthHmacSha1Signer();

mOauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
mOauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);

service = new GoogleService("gmail","feed");
service.setOAuthCredentials(mOauthParameters, mSigner);
service.setConnectTimeout(timeOut);
service.setReadTimeout(timeOut * 5);

GDataRequest request = service.createFeedRequest(new URL(SCOPE +"?xoauth_requestor_id=" + email));
request.execute();
InputStream is = null;

try {
    is = request.getResponseStream();
    StringBuffer out = new StringBuffer();  
    byte[] buffer = new byte[4094];
    int readSize;
    while ( (readSize = is.read(buffer)) != -1) {
        out.append(new String(buffer, 0, readSize));
    }
    result = out.toString();
} catch (Exception e) {
    throw e;
} finally {
    is.close();
} 

I need your help.

Please check our source or other sample for gmail atom feed with 2-legged OAuth.

Regards.

解决方案

Indeed, it seems to be a Google issue. I encourage you to report this to Google, using either the Report a Bug / Provide Feedback option from the menu of the OAuth 2.0 Playground, or within Gmail (Send feedback option, from the menu).

这篇关于带有双腿OAuth的Gmail原子Feed接收401错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆