Skip to content

Unwanted authData validation #3867

Closed
@ghugues

Description

@ghugues

Issue Description

Parse Server is validating authData whenever the user object is updated. In many cases, this is unwanted and makes a perfectly good request fail.
I only tested this with Facebook, but since the handling of authData seems to be build in a rather generic way, I expect this issue to arise with other auth providers as well.

Steps to reproduce

  • Login with Facebook. It will either create a new user and log you in or directly log you in with an existing user.
  • You now have a valid session which should in theory allow you to modify the user however you want.
  • Wait for the Facebook token to expire (about a month), or simulate it by removing the app from the Facebook website (In Settings -> Apps)
  • Your token is no longer valid. Any call to the Facebook API using this token will fail (this is expected).
  • Launch your app again and try to update some fields on the the user. Include the authData field in your PUT request. This is what the iOS SDK does, it includes authData in every request and - as far as I know - this can't be disabled without modifying the SDK code.
  • Although you have a valid session token, Parse Server attempts to validate the authData, which fails. This in turn makes your save request fail.

Expected Results

As long as I have a valid session, I expect to be allowed to modify custom fields on my user object, regardless of the validity of the authData.

I understand that the main issue here is the fact that the iOS SDK includes the authData in all PUT requests, even if it hasn't changed. I also understand that even with a valid session you can't be allowed to put anything in authData because it would allow you to put the id of a Facebook account you don't own.

Actual Outcome

A very real world outcome is the following:

  • You only use Facebook as a login mechanism. You don't care that the token expires after a while because you always have a fresh new token when the user logs in.
  • You don't want to show your users the Facebook login screen again.
  • You can refresh the token in the background every time they use your app, but if they stop using your app for more than a month, the token will expire without you being able to refresh it. So this is not a solution.
  • After a while, all save operations to the User object fail because of this.

Possible fix

If the authData sent in the request is identical to the authData saved in the database, don't perform any validation. You could even go as far as only checking that the id fields of authData are identical and allow any arbitrary change to the token or expiring date without further validation.

Environment Setup

Parse Server version 2.4.1 running locally or on Heroku (tried both)
Node 6.10
MongoDB storage on Mlab.
Tried on iOS only

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions