Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Error: Expected "payload" to be a plain object. #50

Closed
ggmartins opened this issue Nov 11, 2019 · 1 comment
Closed

Error: Expected "payload" to be a plain object. #50

ggmartins opened this issue Nov 11, 2019 · 1 comment

Comments

@ggmartins
Copy link
Contributor

UnhandledPromiseRejectionWarning: Error: Expected "payload" to be a plain object.
...
02/exercises/udacity-c2-restapi/src/controllers/v0/users/routes/auth.router.ts:31:16)

function generateJWT(user: User): string {
    //@TODO Use jwt to create a new JWT Payload containing
    return jwt.sign(user.toJSON(), config.jwt.secret); //toJSON is required 
}

https://stackoverflow.com/questions/47117709/payload-error-in-jsonwebtoken
This was required after npm audit fix for the rest backend. I don't know about the original code. Please advise if I can send a PL please, thanks, G.

@SudKul
Copy link
Contributor

SudKul commented Jan 17, 2022

Fixed in this commit
916b6f4

@SudKul SudKul closed this as completed Jan 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants