parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse Server unauthorized user error

Open devKC opened this issue 9 years ago • 10 comments

We use GitHub Issues for bugs.

If you have a non-bug question, ask on Stack Overflow or Server Fault:

  • https://stackoverflow.com/questions/tagged/parse.com
  • https://serverfault.com/tags/parse

You may also search through existing issues before opening a new one: https://github.com/ParsePlatform/Parse-Server/issues?utf8=%E2%9C%93&q=is%3Aissue

--- Please use this template. If you don't use this template, your issue may be closed without comment. ---

Issue Description

I am suddenly unable to connect to parse server through client (iOS SDK). I haven't made any changes to AppDelegate.swift and the key/server url is correct. I can connect to parse server via local Parse Dashboard with the same key values.

Swift 3, Parse v1.14.2

Steps to reproduce

Make any attempt to connect to Parse Server via iOS client.

Expected Results

I expected the iOS device to be able to connect to Parse Server, and receive 200 OK request status.

Actual Outcome

iOS device is unable to connect to Parse Server, receiving 403 request status with following error message:

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.3.6
    • Operating System: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS and Heroku (remote, tried with both AWS and Heroku)
  • Database

    • MongoDB version: 3.2.12
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

Include all relevant logs. You can turn on additional logging by configuring VERBOSE=1 in your environment.

iOS log:

Error: unauthorized (Code: 0, Version: 1.14.2)

Server log:

at=info method=GET path="/xxxxxxxx" host=xxxxxxxxxxxxx request_id=xxxxxxxxxxxxx fwd="xxxxxxxx" dyno=web.1 connect=0ms service=22ms status=403 bytes=466

devKC avatar Mar 06 '17 03:03 devKC

Are you setting a client key in the server? What about the iOS SDK configuration/initialization? What is the path you redacted that is failing?

Please provide more information

natanrolnik avatar Mar 06 '17 06:03 natanrolnik

  1. No, I'm not setting a client key in the server. 2.
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) ->    Void in
      
            ParseMutableClientConfiguration.applicationId = "xxxxxxxx"
            // I didn't set a clientKey, but tried both with AND without .clientKey
            ParseMutableClientConfiguration.server = "xxxxxxxxx"
            
        })
  1. The path that is failing is the server url listed in the configuration. Client fails to get authorized trying to reach that path. Again, I have no problem while using Parse Dashboard with the same configuration.

devKC avatar Mar 06 '17 13:03 devKC

But what is the path that you marked as path="/xxxxxxxx? Are you taking into account the /parse mount, right?

natanrolnik avatar Mar 06 '17 13:03 natanrolnik

Yes, I'm taking into account the /parse mount. The path is /parse in this case.

devKC avatar Mar 06 '17 14:03 devKC

@devKC you are not setting any client keys in your parse-server configuration? All of the client keys (clientKey, javascriptKey, restAPIKey, dotNetKey) needs to be unset if you want to make a request without a client key.

Also from what version of parse-server are you upgrading?

johanarnor avatar Mar 06 '17 14:03 johanarnor

@johanarnor- no client keys are set at any point. and the parse-server version is 2.3.6 as listed above.

@natanrolnik- do you think this has anything to do with the bcrypt module? I know that there seems to be some installation issues for Parse Server users deploying to Heroku and AWS.

devKC avatar Mar 06 '17 15:03 devKC

@devKC So you just started to use parse-server? Or if it has worked before, what version of parse-server was that? Also, could you post your configuration of your server (with sensitive information anonymized)?

johanarnor avatar Mar 06 '17 16:03 johanarnor

@johanarnor Thank you for your pointer. I have been running parse-server for about a year before this was an issue. I just noticed that below line was in my index.js. I commented it out and client device is able to connect as authorized user.

clientKey: process.env.CLIENT_KEY || ''

I didn't think I was setting any value to the client value by '' but I was wrong. Thank you again for helping me out!

devKC avatar Mar 07 '17 05:03 devKC

No problem. Glad I could help solve your problem!

johanarnor avatar Mar 07 '17 06:03 johanarnor

Glad you found the reason!

natanrolnik avatar Mar 07 '17 06:03 natanrolnik