praxder / gtm-oauth2

Automatically exported from code.google.com/p/gtm-oauth2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

GoogleCodeExporter opened this issue · comments

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

https://github.com/Everalbum/gtm-oauth2/commit/ac1f680ffddb90586071f78e655fe1e2c
6162a4a

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