Thinkful-Ed / node-jwt-auth

15 stars 118 forks source link

Implement local strategy instead of basic #5

Closed cklanac closed 6 years ago

cklanac commented 6 years ago

Here's my implementation of local strategy as an alternative for basic. The PR contains some basic cleanup to be consistent with our eslint config. And of course the local strategy implementation. I tried to add it with as little modification to the original source as possible.

NOTE: local strategy uses form post so I needed to add bodyParser.urlencoded to the router. I'm not thrilled about it. Although, it may be a good opportunity to teach url encoding.

If the consensus is to stay with transmitting data via JSON then we should consider using passport-json instead.

https://www.npmjs.com/package/passport-json

cklanac commented 6 years ago

Paraphrasing TopGun... "the defense department regrets to inform you that your son is dead because he was stupid"

https://youtu.be/fC976fuQm4E?t=2m5s

I changed the endpoint and tests to use bodyParser.json()

cklanac commented 6 years ago

@oampo, Just so it doesn't get lost... This merge should be pushed/exported to the related glitch which appears in the Curriculum https://glitch.com/edit/#!/node-jwt-auth?path=server.js:1:0