Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User can't login becasue of ParseException related to AuthData #935

Closed
rafapetter opened this issue Mar 9, 2016 · 13 comments
Closed

User can't login becasue of ParseException related to AuthData #935

rafapetter opened this issue Mar 9, 2016 · 13 comments

Comments

@rafapetter
Copy link

Issue
Every time I try to login through username/password with a user that was already created on Parse API (before the migration to mongo), I get a ParseException of code -1: java.lang.ClassCastException: org.json.JSONObject$1 cannot be cast to java.util.Map. The debug trace points to line 340 of ParseUser.java:

339  private Map<String, String> getAuthData(String authType) {
340      return getAuthData().get(authType);
341  }

Prerequisites

  • I've migrated to AWS Elastic Beanstalk(64bit Amazon Linux 2015.09 v2.0.7, running Node.js 4.2.3) and MongoLab
  • I'm running the 2.1.4 of Parse Server.
  • I'm testing on Android SDK

Steps to reproduce on Android

  • I've changed the endpoint from parse API to my parse server
  • Installed the app
  • Tried to login with existing user

Log from Verbose
Here we can see that GET actually returns successfully

GET /parse/login { host: 'parseserver-xxxx-env.elasticbeanstalk.com',
  'x-real-ip': 'xxxx',
  'x-forwarded-for': 'xxxxx',
  'content-length': '61',
  'accept-encoding': 'gzip',
  'content-type': 'application/json',
  'user-agent': 'Parse Android SDK 1.13.0 (com.xxxx.xxxx/7) API Level 21',
  'x-newrelic-id': 'xxxx==',
  'x-parse-app-build-version': '7',
  'x-parse-app-display-version': '1.1.3.2',
  'x-parse-application-id': 'xxxx',
  'x-parse-client-key': 'xxx',
  'x-parse-client-version': 'a1.13.0',
  'x-parse-installation-id': 'xxxx',
  'x-parse-os-version': '5.0.2',
  'x-forwarded-port': '80',
  'x-forwarded-proto': 'http' } {
  "username": "xxx@xxxx.com",
  "password": "xxxx"
}
response: {
  "response": {
    "objectId": "xxxxxxxx",

Possible Similar Issues

@gfosco
Copy link
Contributor

gfosco commented Mar 9, 2016

What is the rest of the response? It is cut off..

@rafapetter
Copy link
Author

I'm sorry, here's the GET again. I've covered sensitive data and only removed app custom fields on the response:

GET /parse/login { host: 'parseserver-xxx-env.elasticbeanstalk.com',
  'x-real-ip': 'xxxxx',
  'x-forwarded-for': 'xxxx',
  'content-length': '61',
  'accept-encoding': 'gzip',
  'content-type': 'application/json',
  'user-agent': 'Parse Android SDK 1.13.0 (com.xxx.xxx/7) API Level 21',
  'x-newrelic-id': 'xxxxx==',
  'x-parse-app-build-version': '7',
  'x-parse-app-display-version': 'xxxx',
  'x-parse-application-id': 'xxxxx',
  'x-parse-client-key': 'xxxxx',
  'x-parse-client-version': 'a1.13.0',
  'x-parse-installation-id': 'xxxxx',
  'x-parse-os-version': '5.0.2',
  'x-forwarded-port': '80',
  'x-forwarded-proto': 'http' } {
  "username": "xxxxx@xxxxx.com",
  "password": "xxxxxxxxxx"
}
response: {
  "response": {
    "objectId": "xxxxx",
    "email": "xxxxx@xxxxx.com",
    "updatedAt": "2016-03-07T16:37:11.246Z",
    "username": "xxxxx@xxxxx.com",
    "sessionToken": "r:xxxxxxx",
     "createdAt": "2015-11-16T05:15:26.288Z",
    "email_verified": false,
    "authData": {
      "facebook": null
    }
  }
}

@rafapetter
Copy link
Author

One other difference I've found is that the response for new users have ACL returned:

"ACL": {
        "XXXXXX": {
            "read": true,
            "write": true
        },
        "*": {
            "read": true
        }
    },

And old users don't. On mongodb don't even have the _rperm and _wperm columns

@flovilmart
Copy link
Contributor

@weengo does the fix provided in #952 solves the issue. It seems that the Facebook: null may be causing the issue

@rafapetter
Copy link
Author

I was just about to comment on this. Nope, even testing locally didn't solve. Should I erase mongodb and migrate again to see if there's a problem with ACL fields being missed?

@rafapetter
Copy link
Author

You're right, I've just removed "_auth_data_facebook": null from mongodb, and when tried to access again, it did work. So, that was a case of a user that had sign up as username/password, then later had facebook account linked, and finally have facebook unlinked. So, is that a scenario covered by parse-server?

@flovilmart
Copy link
Contributor

Alright, I'm adding a fix to cleanup those null keys in login

@rafapetter
Copy link
Author

Great, thanks

@flovilmart
Copy link
Contributor

Do you have that on many users? Was the user like that just after the migration?

@rafapetter
Copy link
Author

We have an ID Verification process, so some users may link their facebook accounts to increase ID verification. But we have very few that link and then unlink.

The user was like that before the migration. Haven't been updated since.

@flovilmart
Copy link
Contributor

I've checked and the JS SDK handles it properly, maybe the fix should be in the android SDK.

flovilmart added a commit that referenced this issue Mar 11, 2016
…DatakeysOnLogin

Fixes #935, cleans up authData null keys on login for android crash
@meilers
Copy link

meilers commented Apr 2, 2016

Having the same issue here. Same environment as @weengo, also on Android. In my case my user was created on iOS but I can't get him to log on Android. I investigated the _User object and found that "_auth_data_anonymous" is being returned null.

When I removed that field in mongoDB, it worked.

@flovilmart
Copy link
Contributor

@meilers this is a 21 days old issue, that's been resolved. #1199 should definitively get rid of it. Update parse-server to the latest version. If it doesn't please open an new issue, and post any relevant information as described in the issue report template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants