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

API exercise jwt payload should be a plain object #273

Closed
samuelchvez opened this issue Dec 13, 2020 · 3 comments
Closed

API exercise jwt payload should be a plain object #273

samuelchvez opened this issue Dec 13, 2020 · 3 comments

Comments

@samuelchvez
Copy link

Found that jwt library expects the payload to be a plain object. As seen in the course, we send directly the sequelize model instance, which is not a plain object. To solve it, I used the method short() inside the generateJWT method:

function generateJWT(user: User): string {
    return jwt.sign(user.short(), config.jwt.secret);
}
@samuelchvez samuelchvez changed the title API exercise json payload should be a plain object API exercise jwt payload should be a plain object Dec 13, 2020
@SudKul
Copy link
Contributor

SudKul commented Nov 1, 2021

Hi @samuelchvez
Would you mind submitting a PR for a quick turnaround?
I can see that there are relevant Knowledgehub discussions around the topic.
Thanks

@SudKul
Copy link
Contributor

SudKul commented Jan 17, 2022

Relates to #50 and https://knowledge.udacity.com/questions/76262

SudKul added a commit that referenced this issue Jan 17, 2022
@SudKul
Copy link
Contributor

SudKul commented Jan 17, 2022

Fixed in this commit 916b6f4

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