Skip to content

signUp returns {"error":"unauthorized"} #79

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

Closed
rickspencer3 opened this issue Feb 10, 2019 · 3 comments
Closed

signUp returns {"error":"unauthorized"} #79

rickspencer3 opened this issue Feb 10, 2019 · 3 comments

Comments

@rickspencer3
Copy link
Contributor

rickspencer3 commented Feb 10, 2019

Hi. I'm new to Parse. I started with adding signUp functionality, but I got stuck, and I am hoping you can help me.

I am running parse locally via docker-compose.

These two work:

$ curl -X POST -H "X-Parse-Application-Id: 'app'" -H "Content-Type: application/json" --data '{"username":"eseex","password":"cccc","email":"[email protected]"}' http://127.0.0.1/parse/users

$ curl -X POST -H "X-Parse-Application-Id: 'app'" -H "Content-Type: application/json" --data '{"username":"eeex","password":"cccc","email":"[email protected]"}' http://127.0.0.1/parse/classes/_User

Here is my code:

          Parse().initialize("app", "http://10.0.2.2/parse", debug: true);

          ParseUser user = ParseUser("testUser",
              "asfasfasfd", "[email protected]");
          ParseResponse response = await user.signUp();

Note the different ip address due to running from the emulator. I always receive:

{"error":"unauthorized"}

from these requests. I have spent a few hours debugging, but I just can't figure out where the problem is.

I suspect that there is something fundamental about Parse or running from an emulator that I am not understanding. Any help would be appreciated.

Here is the Parse configuration:

parse_1            | appId: 'app'
parse_1            | masterKey: ***REDACTED***
parse_1            | serverURL: http://127.0.0.1:1337/parse
parse_1            | masterKeyIps: []
parse_1            | appName: parse-server
parse_1            | logsFolder: ./logs
parse_1            | databaseURI: mongodb://bn_parse:82kRGAHhdF@mongodb:27017/bitnami_parse
parse_1            | userSensitiveFields: ["email"]
parse_1            | enableAnonymousUsers: true
parse_1            | allowClientClassCreation: true
parse_1            | maxUploadSize: 20mb
parse_1            | customPages: {}
parse_1            | sessionLength: 31536000
parse_1            | expireInactiveSessions: true
parse_1            | revokeSessionOnPasswordReset: true
parse_1            | schemaCacheTTL: 5000
parse_1            | cacheTTL: 5000
parse_1            | cacheMaxSize: 10000
parse_1            | objectIdSize: 10
parse_1            | port: 1337
parse_1            | host: 0.0.0.0
parse_1            | mountPath: /parse
parse_1            | scheduledPush: false
parse_1            | collectionPrefix: 
parse_1            | preserveFileName: false
parse_1            | verifyUserEmails: false
parse_1            | preventLoginWithUnverifiedEmail: false
parse_1            | enableSingleSchemaCache: false
parse_1            | enableExpressErrorHandler: false
parse_1            | jsonLogs: false
parse_1            | verbose: false
parse_1            | level: undefined

Note that I have redirection port 80 to 1337.

@rickspencer3
Copy link
Contributor Author

Ok, I figured it out. In my docker-compose.yaml, I did this:

  parse:
    image: 'bitnami/parse:latest'
    environment:
      - PARSE_APP_ID='app'
      - PARSE_MASTER_KEY='key'

So, it included the ' before and after app. When I made the header like this, it worked:

"X-Parse-Application-Id": "'app'"

Purely my stupidity.

@phillwiggins
Copy link
Member

phillwiggins commented Feb 11, 2019 via email

@rickspencer3
Copy link
Contributor Author

@phillwiggins Hi, I guess you missed my comment, but the problem seems to be totally my own silliness. I named the app_id literally "'app'" (with the single quotes).So I wasn't passing the correct app_id in the header,.

Thanks for taking a look though. Now that I have this figured out, I should be able to make progress again.

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

2 participants