Skip to content

{ user } returned from getEntity breaks when implementing anonymous auth #3337

Answered by ericuldall
ericuldall asked this question in Q&A
Discussion options

You must be logged in to vote

Confirming this custom jwt strategy addresses the issue:

export class CustomJWTStrategy extends JWTStrategy {
    async getEntity(id, params) {
        const entityService = this.entityService
        const { entity } = this.configuration

        if (entityService === null) {
            throw new NotAuthenticated('Could not find entity service')
        }

        const query = await this.getEntityQuery(params)
        const getParams = Object.assign({}, { ...params, provider: null }, { query })
        return entityService.get(id, getParams)
    }
}

@daffl do you think this should be the default logic? Is there any reason why it shouldn't work this way?

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@daffl
Comment options

@ericuldall
Comment options

@daffl
Comment options

Answer selected by ericuldall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants