带有 2-legged OAuth 的 Gmail atom 提要收到 401 错误 [英] Gmail atom feed with 2-legged OAuth receive 401 error

查看:29
本文介绍了带有 2-legged OAuth 的 Gmail atom 提要收到 401 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们遇到了使用 2-legged OAuth 的 Gmail atom 提要问题,错误消息是401 未授权".

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

错误信息如下.

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

直到上周,我们使用 Gmail atom feed 都没有问题.从本周开始,即使我们在 Gmail atom 提要和 oauth 方面没有任何变化,我们也遇到了这个问题.现在,并非所有用户(50,000 个帐户)都会出现此问题,但此问题越来越多.

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?

源代码如下.

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();
} 

我需要你的帮助.

请查看我们的来源或其他示例,了解使用 2-legged OAuth 的 gmail atom 供稿.

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

问候.

推荐答案

确实,这似乎是 Google 的问题.我鼓励您使用 报告错误/提供反馈选项向 Google 报告此问题="(?)"> OAuth 2.0 Playground,或在 Gmail 中(发送反馈选项,来自 菜单).

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).

这篇关于带有 2-legged OAuth 的 Gmail atom 提要收到 401 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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