Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
952 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...