Created
May 17, 2018 16:16
-
-
Save marshallswain/9e4ceda7b3f839065f009d702cde290b to your computer and use it in GitHub Desktop.
Next.js Feathers auth trick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jwtAuth({ token }) { | |
if (!isClient) { | |
app().set('accessToken', token); | |
return this.verifyToken(token) | |
.then(payload => this.loadUser(payload.userId)); | |
} | |
return app() | |
.authenticate({ strategy: 'jwt', accessToken: token }) | |
.then(response => this.verifyToken(response.accessToken)) | |
.then(payload => this.loadUser(payload.userId)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment