Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON

Joseph Smarr <jsmarr@gmail.com> Wed, 28 April 2010 21:26 UTC

Return-Path: <jsmarr@gmail.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 92D883A6903 for <oauth@core3.amsl.com>; Wed, 28 Apr 2010 14:26:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.448
X-Spam-Level:
X-Spam-Status: No, score=-2.448 tagged_above=-999 required=5 tests=[AWL=0.150, BAYES_00=-2.599, HTML_MESSAGE=0.001]
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 VbLqOl9mZJql for <oauth@core3.amsl.com>; Wed, 28 Apr 2010 14:26:02 -0700 (PDT)
Received: from mail-pw0-f44.google.com (mail-pw0-f44.google.com [209.85.160.44]) by core3.amsl.com (Postfix) with ESMTP id C3DAB3A68B0 for <oauth@ietf.org>; Wed, 28 Apr 2010 14:26:02 -0700 (PDT)
Received: by pwj2 with SMTP id 2so10733384pwj.31 for <oauth@ietf.org>; Wed, 28 Apr 2010 14:25:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type; bh=NM6eorwCf2clj4mx/1cWdKuB5g8ElbBdqUy5xGP+Q3s=; b=B4Kx75F1A0o4hUHjtPLxGqKiY5SRhusj9rYuzcbi+plq5hbPLMw3V9WMOKaisuqSgL e/GL3lHfOiplzbN30UD9C6G0olgSQRY8SPvCtPMpl7rxlmo58zGOnVjhDCRhlb5iUFNu /hXxwkauB47hQWcs2gKBTY1YhkVSnGI67zfQ0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; b=Tgc8eZBsYdxTzYmyj9ocKx7OzOluQiBBEa5MB0z5b0/5XAob17UxsAb4dsjg2lQ0Br hFUPpCm7z9rOIzZD3vs1gO7shl6py/P+OCKoZRGJxQWjtoXzd6STklUKT1d2MtLzEjbx qOEc/vLdnbYUT5EBxY8geXShTJ7djKrALNfyg=
Received: by 10.143.25.39 with SMTP id c39mr4663971wfj.47.1272489947113; Wed, 28 Apr 2010 14:25:47 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.143.164.14 with HTTP; Wed, 28 Apr 2010 14:25:27 -0700 (PDT)
In-Reply-To: <4BD8869A.2080403@lodderstedt.net>
References: <9890332F-E759-4E63-96FE-DB3071194D84@gmail.com> <90C41DD21FB7C64BB94121FBBC2E723438E30A379B@P3PW5EX1MB01.EX1.SECURESERVER.NET> <20100419134825.134951nuzvi35hk4@webmail.df.eu> <90C41DD21FB7C64BB94121FBBC2E723438E5C7F45E@P3PW5EX1MB01.EX1.SECURESERVER.NET> <4BD2A172.2070401@lodderstedt.net> <4BD8869A.2080403@lodderstedt.net>
From: Joseph Smarr <jsmarr@gmail.com>
Date: Wed, 28 Apr 2010 17:25:27 -0400
Message-ID: <s2zc334d54e1004281425x5e714eebwcd5a91af593a62ac@mail.gmail.com>
To: Torsten Lodderstedt <torsten@lodderstedt.net>
Content-Type: multipart/alternative; boundary="001636e0b61e47286f048552a761"
Cc: oauth@ietf.org
Subject: Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: jsmarr@stanfordalumni.org
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, 28 Apr 2010 21:26:04 -0000

I agree we need JSON formatting for all the currently url-encoded responses,
but not for the requests, since that stuff will be handled by normal web
servers. That's all you were saying right? We still need a proposed format
for the JSON, but my strawman would just be take all the key/value pairs
returned currently and encode them as one flat JSON object with those same
exact key/value pairs.

So, using the example in 3.5.2.2, instead of the response body being:

access_token=SlAV32hkKG&expires_in=3600&refresh_token=8xLOxBtZp8

It would be:

{ "access_token": "SlAV32hkKG", "expires_in": "3600", "refresh_token":
"8xLOxBtZp8" }

Any reason that wouldn't work?

Thanks, js

On Wed, Apr 28, 2010 at 3:03 PM, Torsten Lodderstedt <
torsten@lodderstedt.net> wrote:

> no one interested any longer in this topic? I would like to prepare a
> proposal, but I need some feedback.
>
> regards,
> Torsten.
>
> Am 24.04.2010 09:44, schrieb Torsten Lodderstedt:
>
>  Am 20.04.2010 17:10, schrieb Eran Hammer-Lahav:
>>
>>> There seems to be support for this idea with some concerns about
>>> complexity. Someone needs to propose text for this including defining the
>>> request parameter and schema of the various reply formats.
>>>
>>>
>> I would like to prepare some text. Beforehand, I would like to discuss
>> some ideas in order to come to a rough consensous.
>>
>> Basically, I would suggest to only consider cases where the implementation
>> platform does not directly support URI query parameter decoding. From my
>> point of view, this are all HTTP responses a client will need to process.
>> All request parameters, e.g. redirect back to the web server in the web
>> server flow, will still be delivered as "application/x-www-form-urlencoded"
>> only, since the web container automatically prepares this parameters for
>> easy access in the web application.
>>
>> I have compiled a list of candidates:
>>
>> 3.5.1.  User-Agent Flow
>> 3.5.1.1.  Client Requests Authorization
>>
>> fragement of the redirect URL. Change this to base64 encoded XML/JSON,
>> desired format as request parameter
>>
>> 3.5.2.  Web Server Flow
>> 3.5.2.2.  Client Requests Access Token
>>
>> response formats: application/x-www-form-urlencoded, application/xml, or
>> application/json
>> desired format as request parameter
>> response mime type indicates response format
>>
>> 3.5.3.  Device Flow
>> 3.5.3.1.  Client Requests Authorization
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> 3.5.3.2.  Client Requests Access Token
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> 3.6.1.  Username and Password Flow
>> 3.6.1.1.  Client Requests Access Token
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> 3.7.1.  Client Credentials Flow
>> 3.7.1.1.  Client Requests Access Token
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> 3.7.2.  Assertion Flow
>> 3.7.2.1.  Client Requests Access Token
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> 4.  Refreshing an Access Token
>>
>> proposal see 3.5.2.2.  Client Requests Access Token
>>
>> Any comments?
>>
>> regards,
>> Torsten.
>>
>>> EHL
>>>
>>>  -----Original Message-----
>>>> From: Torsten Lodderstedt [mailto:torsten@lodderstedt.net]
>>>> Sent: Monday, April 19, 2010 4:48 AM
>>>> To: Eran Hammer-Lahav
>>>> Cc: Dick Hardt; OAuth WG
>>>> Subject: Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
>>>>
>>>>
>>>>  We can also offer both and define a client request parameter (as long
>>>>> as the server is required to make at least one format available).
>>>>>
>>>> +1 on this
>>>>
>>>> regards,
>>>> Torsten.
>>>>
>>>>  EHL
>>>>>
>>>>>  -----Original Message-----
>>>>>> From: oauth-bounces@ietf.org [mailto:oauth-bounces@ietf.org] On
>>>>>> Behalf Of Dick Hardt
>>>>>> Sent: Sunday, April 18, 2010 9:30 PM
>>>>>> To: OAuth WG
>>>>>> Subject: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
>>>>>>
>>>>>> The AS token endpoint response is encoded as application/x-www-form-
>>>>>> urlencoded
>>>>>>
>>>>>> While this reuses a well known and understood encoding standard, it
>>>>>> is uncommon for a client to receive a message encoded like this. Most
>>>>>> server responses are encoded as XML or JSON. Libraries are NOT
>>>>>> reedily available to parse application/x-www-form-urlencoded results
>>>>>> as this is something that is typically done in the web servers
>>>>>> framework. While parsing the name value pairs and URL un-encoding
>>>>>> them is not hard, many developers have been caught just splitting the
>>>>>>
>>>>> parameters and forgetting to URL decode the token.
>>>>
>>>>> Since the token is opaque and may contain characters that are
>>>>>> escaped, it is a difficult bug to detect.
>>>>>>
>>>>>> Potential options:
>>>>>>
>>>>>> 1) Do nothing, developers should read the specs and do the right
>>>>>> thing.
>>>>>>
>>>>>> 2) Require that all parameters are URL safe so that there is no
>>>>>> encoding issue.
>>>>>>
>>>>>> 3) Return results as JSON, and recommend that parameters be URL safe.
>>>>>>
>>>>>> -- Dick
>>>>>> _______________________________________________
>>>>>> OAuth mailing list
>>>>>> OAuth@ietf.org
>>>>>> https://www.ietf.org/mailman/listinfo/oauth
>>>>>>
>>>>> _______________________________________________
>>>>> OAuth mailing list
>>>>> OAuth@ietf.org
>>>>> https://www.ietf.org/mailman/listinfo/oauth
>>>>>
>>>>>
>>>>
>>>>
>>
>> _______________________________________________
>> OAuth mailing list
>> OAuth@ietf.org
>> https://www.ietf.org/mailman/listinfo/oauth
>>
>
>
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth
>