So, i got an apollo server running and an apollo-client in my iOS app.
I'm trying to implement an authentication process. And following apollo's documentation about authorization and authentication, i ended up trying the code they provided :
context: ({ req }) => {
throw new AuthenticationError('you must be logged in');
},
But, while testing the code, i discovered that throwing an error wether it is a javascript one, or an apollo error, it always sends back an http 400 error :
Error: Response not successful: Received status code 400
at new ApolloError (errors.cjs.js:31)
at core.cjs.js:1493
at both (utilities.cjs.js:963)
at utilities.cjs.js:956
at tryCallTwo (core.js:45)
at doResolve (core.js:200)
at new Promise (core.js:66)
at Object.then (utilities.cjs.js:956)
at Object.error (utilities.cjs.js:964)
at notifySubscription (Observable.js:140)
The authentication error is not sent back. Even when i throw a custom error, with custom status code and everything it always returns the same error.
Am i doing something wrong ? Or is this an issue ?