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.

rds
  • 26,253
  • 19
  • 107
  • 134
  • 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... – Mark Embling Jun 22 '14 at 12:11
  • Having the same issue with Gmail-Notifier. https://github.com/jashephe/Gmail-Notifier/issues/20 – Guillaume Boudreau Jun 22 '14 at 13:58
  • I have the same issue, even the google oauth playground has the issue. – sboire Jun 22 '14 at 15:03
  • 1
    Now, the issue is resolved in our domain. – user3762739 Jul 01 '14 at 11:55
  • The issue is also resolved for me. – Mark Embling Jul 02 '14 at 09:13
  • I have exactly the same issue, you can have a look: [http://stackoverflow.com/questions/24366704/access-to-gmail-atom-feed-with-oauth2-from-android-app-stopped-working](http://stackoverflow.com/questions/24366704/access-to-gmail-atom-feed-with-oauth2-from-android-app-stopped-working) Has anyone reported that to Google already? **EDIT** - RESOLVED on 1.7.2014 – raduz Jun 23 '14 at 13:57
  • I reported that behaviour. – raduz Jun 23 '14 at 18:35
  • Thanks for reporting the issue, the engineers are working on a fix. – Claudio Cherubino Jun 23 '14 at 22:16
  • 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. – raduz Jun 25 '14 at 00:06
  • 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 :) – Claudio Cherubino Jun 25 '14 at 01:20
  • My issue is was resolved. – raduz Jul 01 '14 at 20:58

1 Answers1

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

Guillaume Boudreau
  • 2,676
  • 29
  • 27
  • 1
    Thank you for your comments. We reported this bug to Google. – user3762739 Jun 23 '14 at 09:41
  • I also reported it, via Gmail's feedback option. – Mark Embling Jun 23 '14 at 19:05
  • 3
    Thanks for reporting the issue, the engineers are working on a fix. – Claudio Cherubino Jun 23 '14 at 22:15
  • 1
    Is the issue resolved? My code does not work still now. – user3762739 Jun 28 '14 at 19:15
  • 1
    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 :( – CMR Jul 01 '14 at 07:50
  • 1
    @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. – Mark Embling Jul 02 '14 at 09:15
  • 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]: http://stackoverflow.com/users/186674/claudio-cherubino – Steve Daniels Jul 01 '14 at 10:12