Add workaround for Facebook oauth bug to oauth2 package #12366
Labels
area-pkg
Used for miscellaneous pkg/ packages not associated with specific area- teams.
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @MaxHorstmann
Facebook's oauth2 implementation has a bug. It returns the access token as plain text (text/plain) instead of json (application/json).
See e.g. http://stackoverflow.com/questions/3862108/facebook-oauth-access-token-missing
Unforunately, this breaks the oauth2 package (http://pub.dartlang.org/packages/oauth2) right here: https://code.google.com/p/dart/codesearch#dart/trunk/dart/pkg/oauth2/lib/src/handle_access_token_response.dart&l=37
Ideally Faceboook should fix this return json like the oauth2 spec says, but well, so far they haven't done so.
Since Facebook sign-in is a fairly common use case, my suggestion is to add some flexibility here and handle both a json or plaintext response. The plaintext response string looks like this:
access_token=CAAC9nzmHiUwBAE36sC6fPvDOtlZAFGfoLEfZAcfS2VnEOyo7ZCvckG55tCvzwRQNuSl2unMpFYxxxxxdostdNU38grYyEVSIUe2MhIWXII0ufc380vUc56B6cYAtli153PKuEZA1BT44AoyrtQTc3UT6meZAiO1YZD&expires=5181866
The text was updated successfully, but these errors were encountered: