7

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

Spaceface16518
  • 101
  • 3
  • 8

3 Answers3

8

FROM

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

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

Chris
  • 109
  • 1
  • 3
7

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

Devorein
  • 1,112
  • 2
  • 15
  • 23
5

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

barryjones
  • 2,149
  • 1
  • 17
  • 21