As long as we spec that the response can only contain one parameter (either
"error" or "access_token") then the code to parse it in PHP is as follows:

list($param, $value) = explode('=', $response, 2);
if ($param == 'access_token') {
} elseif ($param == 'error') {
}


If it can contain more than one value, then parsing becomes more difficult
and JSON starts to make sense.

--David


On Wed, May 5, 2010 at 8:42 AM, Marius Scurtescu <mscurte...@google.com>wrote:

> On Wed, May 5, 2010 at 8:28 AM, Eran Hammer-Lahav <e...@hueniverse.com>
> wrote:
> > I'll add something to the draft and we'll discuss it. There is enough
> consensus on a single JSON response format.
>
> Yesterday I got the following feedback:
>
> On Tue, May 4, 2010 at 5:43 PM, Greg Robbins <grobb...@google.com> wrote:
> > Using JSON on the iPhone requires developers to drag in source code for a
> > third-party library.
> >
> > If their app isn't already relying on JSON for some other purpose, then
> > adding a third-party library is a somewhat substantial annoyance,
> > particularly for a mobile app where code size is important.
> >
> > If OAuth 2 is only intended for use with JSON APIs, then returning all
> > responses as JSON is reasonable. Otherwise, it's not so reasonable. A
> full
> > JSON parser is non-trivial, and seems like overkill for simple responses.
> >
> > The iPhone OS does have libxml2 and an event-style XML parser, but no
> really
> > easy way to extract data from XML, either.
> >
> > Form-style responses are much more straightforward to worth with given
> > simple string-manipulation utilities.
>
> If the above is true, then I am not so sure about JSON anymore. Lots
> of phones and devices will have problems with it.
>
> Marius
> _______________________________________________
> 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

Reply via email to