Re: [OAUTH-WG] Returning HTTP 200 on Error for JSONP

Luke Shepard <lshepard@facebook.com> Wed, 18 August 2010 07:11 UTC

Return-Path: <lshepard@facebook.com>
X-Original-To: oauth@core3.amsl.com
Delivered-To: oauth@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 714E93A6A15 for <oauth@core3.amsl.com>; Wed, 18 Aug 2010 00:11:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.168
X-Spam-Level:
X-Spam-Status: No, score=-102.168 tagged_above=-999 required=5 tests=[AWL=0.232, BAYES_00=-2.599, HELO_MISMATCH_COM=0.553, HOST_MISMATCH_NET=0.311, HTML_MESSAGE=0.001, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oMcJTNpdeWMu for <oauth@core3.amsl.com>; Wed, 18 Aug 2010 00:11:57 -0700 (PDT)
Received: from mx-out.facebook.com (outmail003.snc1.tfbnw.net [69.63.178.162]) by core3.amsl.com (Postfix) with ESMTP id C74823A6A1E for <oauth@ietf.org>; Wed, 18 Aug 2010 00:11:57 -0700 (PDT)
Received: from [10.18.255.125] ([10.18.255.125:49292] helo=mail.thefacebook.com) by mta014.snc1.facebook.com (envelope-from <lshepard@facebook.com>) (ecelerity 2.2.2.45 r(34067)) with ESMTP id 84/3E-21639-1E78B6C4; Wed, 18 Aug 2010 00:12:33 -0700
Received: from SC-MBX05.TheFacebook.com ([169.254.4.134]) by sc-hub04.TheFacebook.com ([fe80::8df5:7f90:d4a0:bb9%11]) with mapi; Wed, 18 Aug 2010 00:12:32 -0700
From: Luke Shepard <lshepard@facebook.com>
To: Eran Hammer-Lahav <eran@hueniverse.com>
Thread-Topic: [OAUTH-WG] Returning HTTP 200 on Error for JSONP
Thread-Index: AQHLPqS5pAQSxMChcE2IAPt7ryHRWw==
Date: Wed, 18 Aug 2010 07:12:28 +0000
Message-ID: <2A2D3A70-1202-443E-9263-5AEA66F246CC@facebook.com>
References: <1643FCF1-841F-41FF-B8A8-43269320CFA8@facebook.com> <90C41DD21FB7C64BB94121FBBC2E72343B3F1D7219@P3PW5EX1MB01.EX1.SECURESERVER.NET>
In-Reply-To: <90C41DD21FB7C64BB94121FBBC2E72343B3F1D7219@P3PW5EX1MB01.EX1.SECURESERVER.NET>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: multipart/alternative; boundary="_000_2A2D3A701202443E92635AEA66F246CCfacebookcom_"
MIME-Version: 1.0
Cc: OAuth WG <oauth@ietf.org>
Subject: Re: [OAUTH-WG] Returning HTTP 200 on Error for JSONP
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/oauth>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Aug 2010 07:11:59 -0000

For example, how is the client going to get the original HTTP status code?

Why does the client need the HTTP status code? It seems like the real data is the OAuth error code (i.e., "invalid request"). The HTTP status code is just gravy so that we're consistent with HTTP.

This is not a legal document, and you are free to implemented it differently if you do it in a way that does not harm interop. In this case, you are basically proposing changing a MUST to a SHOULD, which takes away any interop value the requirement has in the first place (ie. being predictable and consistent).

Okay ... so why are we specifying HTTP codes at all then? Since we have clearly defined the error types, why is it wrong to say "use whatever HTTP code you think is right, here are some suggestions"?

If JSONP is an important use case

It is.

and if it should be consistently implemented across services, then it needs to be specified and such a specification can clear override the core specification directive on HTTP status code.

I dunno, JSONP is pretty commonly implemented across lots of services today. You typically pass in the parameter "callback" and then that prepends your response. I'm not aware of a specification for it, but convention + copying each other has made services somewhat consistent in this.

In any case, I don't think this group should be held up by writing a new spec just to address this one use case.

I don’t know where people got the idea that other specifications cannot modify requirements in the core specification – that’s just silly. As long as you spell it out and provide enough detail to maintain interop with the new work, it is perfectly fine. This is not the constitution.

(The Constitution allows amendments, too - but similarly, it's a lot of work)





From: oauth-bounces@ietf.org<mailto:oauth-bounces@ietf.org> [mailto:oauth-bounces@ietf.org] On Behalf Of Paul Tarjan
Sent: Friday, August 13, 2010 2:31 PM
To: OAuth WG
Subject: [OAUTH-WG] Returning HTTP 200 on Error for JSONP

Hi Fellow OAuthers,

If a resource wants to return data via the JSONP mechanism then it MUST return an HTTP 200 error code, or else the browser won't actually call the callback. The OAuth spec as it stands requires HTTP 400 or 401 or 403 on errors which won't ever tell the client that an error happens.

For example:
GET /me?callback=jsonp_cb HTTP/1.1
Host: graph.facebook.com<http://graph.facebook.com/>

HTTP/1.1 200 OK
Content-Type: text/javascript; charset=UTF-8
Content-Length: 152
jsonp_cb({
   "error": "invalid_request",
   "error_description": "An active access token must be used to query information about the current user."
});

would never get sent to the browser if we obeyed the spec and sent it as an HTTP 400.

---
So, I recommend we add wording to 5.2.1 like:

If the protected resource is issuing a response that requires a different HTTP status code than the one specified (for example, JSONP), then it MAY use an alternate HTTP code. The server should make it clear which parameters trigger this mode so that clients know not to rely on the HTTP status code for error detection.


Paul
_______________________________________________
OAuth mailing list
OAuth@ietf.org<mailto:OAuth@ietf.org>
https://www.ietf.org/mailman/listinfo/oauth