TakafumiInoue / gtm-oauth2

Automatically exported from code.google.com/p/gtm-oauth2
0 stars 0 forks source link

Support text/javascript as valid content-type for JSON responses #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Do OAuth2 with Dropbox Core API using gtm-oauth2

What is the expected output? What do you see instead?

Expect: get access token back
Actual: get nil for the access token

What version of the product are you using? On what operating system?

latest

Please provide any additional information below.

GTMOAuth2Authentication.m in 

- (void)tokenFetcher:(GTMOAuth2Fetcher *)fetcher
    finishedWithData:(NSData *)data
               error:(NSError *)error {

determines if the response is JSON when a response's Content-Type is 
"application/json"

some services, like dropbox, are returning JSON and setting Content-Type to 
"text/javascript".  When that happens gtm-oauth doesn't parse the response 
properly, succeeding but not passing the access token along.

The dart team ran into the same snag and fixed their stuff: 
https://code.google.com/p/dart/issues/detail?id=17067

Original issue reported on code.google.com by s...@stridelabs.com on 21 Feb 2015 at 7:48

GoogleCodeExporter commented 9 years ago
https://github.com/Everalbum/gtm-oauth2/commit/ac1f680ffddb90586071f78e655fe1e2c
6162a4a

Original comment by s...@stridelabs.com on 21 Feb 2015 at 8:13