parse-community / ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
http://docs.parseplatform.org/android/guide/#facebook-users
Other
53 stars 63 forks source link

"Cannot modify user" exception occurs in ParseFacebookUtils.initialize #34

Closed kazukinr closed 6 years ago

kazukinr commented 6 years ago

Hi, Developers.

We are using Parse as backend in our app and using ParseFacebookUtils library. We have a problem that user who logged in via Facebook and Parse for other platform(probably parse-server), can not log in to Android app.

Stack trace is below.

2018-05-16 07:03:09 ERROR  com.parse.ParseRequest$ParseRequestException: Cannot modify user **********.
    at com.parse.ParseRequest.newPermanentException(ParseRequest.java:271)
    at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:301)
    at com.parse.ParseRequest$3.then(ParseRequest.java:137)
    at com.parse.ParseRequest$3.then(ParseRequest.java:133)
    at bolts.i$6.run(Task.java:917)
    at bolts.c$a.execute(BoltsExecutors.java:105)
    at bolts.i.b(Task.java:908)
    at bolts.i.b(Task.java:715)
    at bolts.i.b(Task.java:726)
    at bolts.i$4.then(Task.java:818)
    at bolts.i$4.then(Task.java:806)
    at bolts.i$6.run(Task.java:917)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)

We checked this and finally found out the cause of this. In this case, expiration_date of Facebook auth data is invalid format. FacebookController.java expects PRECISE date format yyyy-MM-dd'T'HH:mm:ss.SSS’Z’, but expiration_date is formatted as IMPRECISE date format yyyy-MM-dd'T'HH:mm:ss’Z’ like 2017-12-28T08:06:56Z.

The user can log in to iOS app, but can not log in to Android app. I think it’s better the user with IMPRECISE expiration_date can log in to Android app too.

I guess exception occurs at this line. https://github.com/parse-community/ParseFacebookUtils-Android/blob/v4-1.10.5/library/src/main/java/com/parse/FacebookController.java#L170

If it’s ok, I’ll try to send PR for this.

Thanks.

rogerhu commented 6 years ago

Please do. :) . And to the extent we need to release updates for Facebook login, would appreciate any changes needed. Happy to tag and release the version once the PR's merged.

kazukinr commented 6 years ago

Thanks for your quick response. I'll try.