-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Adding a javasciptKey results in all requests failing as unauthorized #8071
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
Comments
Thanks for opening this issue!
|
It would make sense for Parse Server to enforce a key for every client type if any client key is set. Otherwise you could just use a different client and I don't think Parse Server has an option to disable certain client types. From the docs:
The docs may be ambiguous about that, but I think in hosted Parse that was the behavior, and the intention when open-sourcing was surely to replicate that behavior. Did you try setting a client key also for the iOS SDK? |
Yep adding a client key to each platform's app is what's required, many thanks. Unfortunately it probably means a long delay or cancelation for my web project since I will need all of my users to update first or else their apps will just stop working overnight. I think the prevailing advice everywhere you look these days is "You don't need a client key anymore" so I guess not many people have tried adding one later. It might be better that we try to recommend always adding a client key for future-compatibility if this current behavior is going to be enforced by the server. Alternatively, am I missing something and the javascript key should not be necessary either? My understanding is that we must provide it for server-side data fetching for our React web page. Perhaps a question for the web SDK team but maybe you know. As for the docs specifically, I think this would be a helpful change:
Let me know if you would like a PR for this. |
I just found this similar conversation which confirms your diagnosis: #159 (comment) It is a good example of the 'prevailing advice' I mentioned:
This is common advice when people ask about client keys. So one of these is true:
Or,
|
I have a functioning Parse Server up and running and an iOS app successfully accessing it. Everything has been running well for a couple of years.
I didn't add a
javascriptKey
when setting up the server, but want to add one now to support some web development. However, adding this key to my server configuration viaindex.js
results in all requests from the app failing as unauthorized. It is something specific about thejavascriptKey
property, since adding ajavascriptKey2
instead does not produce the issue. It seems like the server is expecting some additional authorization to be sent by the iOS app when there is ajavascriptKey
set on the server, but the iOS app doesn't know or care about anyjavascriptKey
. I'm not even sure it is possible to set a javascript key via the iOS SDK.There is no logging from the server for this. I can run the server locally and nothing is logged when the failed request is returned.
Steps to reproduce:
javascriptKey
and confirm that your app can access it.javascriptKey
to the server.Expected: the app continues to access the server as before.
Actual: all requests fail as "unauthorized"
I am on Parse Server 4.2.0. I couldn't find any mention of this issue in any releases since (or previously) then so am hopeful there is
a common solution that doesn't involve upgrading to 5.x quite yet!
The text was updated successfully, but these errors were encountered: