Skip to content

Can/Should user.authData.anonymous ever be null? #639

Closed

Description

@yuzeh

Hi,

Whenever an anonymous user is registered, the "authData" column for that user becomes:

{"anonymous": null}

This differs (I believe) from the behavior of hosted Parse in that hosted Parse would simply omit the authData column if it ever encountered this value.

The current behavior of parse-server with regard to this doesn't seem to affect the iOS SDK, but does cause a few problems with the Android SDK.

I filed an issue against the Android SDK, and I was told this was a parse-server issue.

How should I proceed?

Activity

  1. gfosco commented on Feb 26, 2016

    @gfosco
    Contributor

    Looks like this can happen when an anonymous user is unlinked... There should always be an id key in there... Is this easily reproducible with any user?

  2. yuzeh commented on Feb 26, 2016

    @yuzeh
    ContributorAuthor

    This happens every time an anonymous user who has data saved to the cloud performs a registration.

    I'm not sure how to simulate that with just REST API calls. Is there an easy way to log the HTTP requests being made on the iOS or Android SDKs?

  3. gfosco commented on Mar 6, 2016

    @gfosco
    Contributor

    If you run the server with the environment variable VERBOSE=1 you get log output of all the requests and responses... What do you mean by "performs a registration" ? Are they already an anonymous user and then their authData changes?... I'm going to close this but if you get back with more details we can re-open it or move to a new issue. Thanks.

  4. lolobosse commented on Mar 22, 2016

    @lolobosse

    Good afternoon, I have the same issue as mentioned and I have the verbose mode activated on my server:

    Here are the logs:

    PUT /parse/classes/_User/cpzmYUz9iK { 'x-parse-os-version': '5.1.1',
      'x-parse-app-build-version': '2600',
      'x-parse-client-key': 'xxxxx',
      'x-parse-client-version': 'a1.13.0',
      'x-parse-app-display-version': '0.2.69',
      'x-parse-installation-id': '15eb635b-2905-4c2f-bfcd-117129ae7934',
      'user-agent': 'Parse Android SDK 1.13.0 (jobninja.eu.jobninja.local.debug/2600) API Level 22',
      'x-parse-session-token': 'xxxxxx',
      'x-parse-application-id': '0B5jvlihE6yxQed1w9vRSRW0DRldy3fbwqaCjpyF',
      'content-type': 'application/json',
      'content-length': '291',
      host: 'www.xxxxxxxx.eu:1337',
      connection: 'Keep-Alive',
      'accept-encoding': 'gzip',
      pragma: 'no-cache',
      'cache-control': 'no-cache' } {
      "nationality": "AR",
      "firstName": "bbbbbb",
      "password": "hhh",
      "username": "hhhhh@hh.co",
      "authData": {
        "anonymous": null
      },
      "phone": "+49xxxxxxx",
      "lastName": "bbbbhkk",
      "name": "bbbbbb bbbbhkk",
      "email": "hhhhh@hh.co",
      "birthday": {
        "__type": "Date",
        "iso": "1990-01-22T15:43:33.875Z"
      },
      "objectId": "cpzmYUz9iK"
    }
    response: {
      "response": {
        "updatedAt": "2016-03-22T15:43:52.989Z"
      }
    }
    

    Actually it has only one issue, it saves every data except the username and also it only works one time: if you redo the request, it will lead you to a 206 error. I guess it is a bug of Android SDK more than Parse Server issue.

    But what I'm sure is that the version of my code works with Parse.com

  5. flovilmart commented on Mar 22, 2016

    @flovilmart
    Contributor

    Setting authData.anonymous to null is the signal sent to parse-server that we should delete the anonymous authData from the user, it occurs alongside setting a username and password or linking with a 3rd party auth.
    The client SDK is responsible for setting authData.anonymous to null.

    Are you sure the username don't get saved to the database? That seems very odd.

    the 206 errors is when the session is missing.  SESSION_MISSING: 206,

  6. lolobosse commented on Mar 22, 2016

    @lolobosse

    Hey @flovilmart,

    First, thanks for your time.

    image

    Ok so in my case it is normal that I send authData: null because I'm transforming the anonymous into a normal one (with username and password, as you can see in the request).

    In the request I posted above, is there something which should be different?

    I'll try to see in the mongo directly but I assume the Parse Dashboard is correct for such a thing right?

  7. flovilmart commented on Mar 22, 2016

    @flovilmart
    Contributor

    I see now, the username don't get updated properly right?

  8. lolobosse commented on Mar 22, 2016

    @lolobosse

    No it doesn't and it is not the only problem: after this, I have an update for the user where he enters some data and I send that:

    PUT /parse/classes/_User/bSq5BhkDHH { 'x-parse-os-version': '5.1.1',
      'x-parse-app-build-version': '2600',
      'x-parse-client-key': 'ywXpuXNYXggXZGcuAPQd3IX7d0hzPwgl3yMkKdXt',
      'x-parse-client-version': 'a1.13.0',
      'x-parse-app-display-version': '0.2.69',
      'x-parse-installation-id': '88bcf0d5-7b31-40ca-833e-c73d69c16e97',
      'user-agent': 'Parse Android SDK 1.13.0 (jobninja.eu.jobninja.local.debug/2600) API Level 22',
      'x-parse-session-token': 'r:0aae1482c7b4a7420036fe2916b3e61f',
      'x-parse-application-id': '0B5jvlihE6yxQed1w9vRSRW0DRldy3fbwqaCjpyF',
      'content-type': 'application/json',
      'content-length': '303',
      host: 'www.jobninja.eu:1337',
      connection: 'Keep-Alive',
      'accept-encoding': 'gzip',
      pragma: 'no-cache',
      'cache-control': 'no-cache' } {
      "Criteria": [
        {
          "Führerschein-Klasse D": false
        },
        {
          "Immatrikulationsbescheinigung": false
        },
        {
          "Deutsch - fließend": true
        },
        {
          "Englischkenntnisse": false
        },
        {
          "Mindestens 18 Jahre alt": false
        },
        {
          "Führerschein-Klasse C": false
        },
        {
          "Deutsch Grundkenntnisse": false
        },
        {
          "Führerschein-Klasse B": false
        }
      ],
      "objectId": "bSq5BhkDHH"
    }
    

    And I receive that:

    error: ParseError { code: 206, message: 'cannot modify user bSq5BhkDHH' }
    

    And I'm pretty sure it is closely related.

  9. added
    type:bugImpaired feature or lacking behavior that is likely assumed
    and removed on Mar 22, 2016
  10. flovilmart commented on Mar 22, 2016

    @flovilmart
    Contributor

    Not sure I'll have time to cover that, but i'll try to have a look

  11. lolobosse commented on Mar 22, 2016

    @lolobosse

    Great! Because it is actually pretty problematic for every Android Code using Parse Server. Nevertheless, I'm fully available to help! Do you have a snippet of Android which is working with Anonymous and Parse server (from all what I tried, I didn't succeed)

  12. flovilmart commented on Mar 22, 2016

    @flovilmart
    Contributor

    We use mostly unit tests as edge to edge testing is far more complex. Try to reproduce through a unit test your problem, that would be a good start if you wanna help :) there are plenty of examples in the spec folder of the repository of what you're trying to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions