Gmail atom feed with 2-legged OAuth receive 401 error
Asked Answered
H

1

7

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.

Headrest answered 21/6, 2014 at 19:20 Comment(11)
I'm afraid I can't help you resolve this, but I too am having this issue. Unlike you, I'm using OAuth 2.0 and a service account to have my app act on behalf of our users (basically its the OAuth 2.0 equivalent of 2-legged OAuth 1.0), and I'm seeing the exact same error message you report. It's mayhem as I log all failures and it's basically ALL failing now! Have tweeted out to Google, but I doubt I'll get a response...Ching
Having the same issue with Gmail-Notifier. github.com/jashephe/Gmail-Notifier/issues/20Ticklish
I have the same issue, even the google oauth playground has the issue.Baugher
I have exactly the same issue, you can have a look: https://mcmap.net/q/1627100/-access-to-gmail-atom-feed-with-oauth2-from-android-app-stopped-working Has anyone reported that to Google already? EDIT - RESOLVED on 1.7.2014Two
I reported that behaviour.Two
Thanks for reporting the issue, the engineers are working on a fix.Illusory
Some questions that might help also others: Is there any time horizon when to expect a fix? Is there any official statement? Where is that information that engineers are fixing that, from? Thank you.Two
The fix is going through the release process, it should land to production by the end of the week. The information comes directly from the engineers working on it :)Illusory
Now, the issue is resolved in our domain.Headrest
My issue is was resolved.Two
The issue is also resolved for me.Ching
T
3

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

Ticklish answered 23/6, 2014 at 2:31 Comment(7)
Thank you for your comments. We reported this bug to Google.Headrest
I also reported it, via Gmail's feedback option.Ching
Thanks for reporting the issue, the engineers are working on a fix.Illusory
Is the issue resolved? My code does not work still now.Headrest
Any news on this? We're using the gmail block for our VLE and students now can't access their UCAS emails and whatnot which comes at the worst possible time :(Mcclintock
Having been affected by this problem since the first report here, we are now experiencing the error at a much smaller frequency. We've got about 4000 daily users, previously we were seeing errors at least every 30 seconds, now the most recent was 25 minutes ago. I imagine the fix has now gone through testing and has been deployed across most of Google's servers. Thanks go out to [Claudio] for going the extra mile and keeping us informed. [Claudio]: stackoverflow.com/users/186674/claudio-cherubinoBenzedrine
@ConnWarwicker For us (also an educational institution with Gmail integration within internal systems), the situation is now resolved. I'd recommend giving it another go if you haven't already. Best of luck to you and your students.Ching

© 2022 - 2024 — McMap. All rights reserved.