Spaceface16518
Spaceface16518

Reputation: 101

MongoDB Stitch throwing anon-user error

I am using mongodb's stitch backend to run an application, and when I try to login as an anonymous user, it throws this error:

failed to log in anonymously: { StitchError: authentication via 'anon-user' is unsupported
at /*****/*****/*****/****/node_modules/mongodb-stitch/dist/node/common.js:29:19
at
at process._tickCallback (internal/process/next_tick.js:160:7)
name: 'StitchError',
response:
Body {
url: '*****',
status: 401,
statusText: 'Unauthorized',
headers: Headers { _headers: [Object] },
ok: false,
body:
Gunzip {
_readableState: [ReadableState],
readable: false,
domain: null,
_events: [Object],
_eventsCount: 4,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: true,
_transformState: [Object],
bytesRead: 81,
_handle: null,
_hadError: false,
_writeState: [Uint32Array],
_outBuffer: ,
_outOffset: 57,
_level: -1,
_strategy: 0,
_chunkSize: 16384,
_flushFlag: 0,
_scheduledFlushFlag: 0,
_origFlushFlag: 0,
_finishFlushFlag: 4,
_info: undefined },
bodyUsed: true,
size: 0,
timeout: 0,
_raw:
[ ],
_abort: false,
_bytes: 57 },
json: { error: 'authentication via \'anon-user\' is unsupported' } }

Items marked with ***** were removed for privacy.

I have anonymous authentication enabled in Stitch Admin Console, but it still throws this error. My app is not even able to perform any operations on the database before this happens, so I know it does not have to do with my app's Rules.

Is there something I don't know about anonymous auth?

If you know where the mongodb error reference is, that would help as well.

Thanks

Upvotes: 7

Views: 4389

Answers (3)

Devorein
Devorein

Reputation: 1319

First you must allow anonymous login

Allow Users to login anonymously

Click on the review and deploy changes at the top of the stitch UI

Review and deploy changes

Upvotes: 7

Chris
Chris

Reputation: 109

FROM

https://github.com/Spaceface16518/Converse/issues/22

"I think you have to deploy it in the deploy session"

Upvotes: 8

barryjones
barryjones

Reputation: 2309

You need to go Stitch Apps > Users > Providers > Allow users to login anonymously and enable that option.

Upvotes: 5

Related Questions