feathersjs-ecosystem / client

[MOVED] Client side Feathers build
https://github.com/feathersjs/feathers
MIT License
111 stars 27 forks source link

How to allow unauthorised call from client #286

Closed RolandvdH closed 5 years ago

RolandvdH commented 6 years ago

I'm not sure this is an issue or just me being in the dark.

I have a registration page which should communicate with the feathers backend unauthorised (the user has still to be made).

When dispatching to this.$store.dispatch('users/create', {})

the client reports an error

TypeError: Cannot convert undefined or null to object populate-access-token.js:9 at Function.assign () at Object.eval (webpack-internal:///./node_modules/@feathersjs/authentication-client/lib/hooks/populate-access-token.js:9:12) at promise.then.hookObject (webpack-internal:///./node_modules/@feathersjs/commons/lib/hooks.js:142:73)

This is correct, since the call to app.get('accessToken') will result in undefined.

After updating populate-access-token.js to

: if (app.get('accessToken')) { Object.assign(hook.params, { accessToken: app.get('accessToken') }); } :

the code seems to work as I want.

I'm thinking this is not the way to do this. Surely this is a common use case, so what am I missing here? Any advice is appreciated.

daffl commented 5 years ago

A recipe for anonymous authentication has been added to the Feathers cookbook.