Resolver with passport-local example (GraphQL)
gcherem opened this issue · comments
I'm submitting a...
[ ] Regression
[ ] Bug report
[ ] Feature request
[X] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
https://docs.nestjs.com/techniques/authentication#graphql has a fine example on passport-local with nestjs. Thank you!
But unfortunately I could not find an example on how to implement the login mutation. I mean I suppose return this.authService.login(req.user)
but since my login resolver method is
auth.resolver.ts
@Mutation()
@UseGuards(LocalAuthGuard)
async login(@Args('data') data: LoginInput): Promise<string> {
return this.authService.login(?????);
}
auth.gql
input LoginInput {
email: String!
password: String!
}
type Mutation {
login(data: LoginInput!): String! # I suppose it returns a jwt!
}
So how can I provide the user object is such context?
P.S.: Considering the same service, module, etc. from that example
Expected behavior
To have an example of login resolver in the GraphQL section in that page, or a complete sample of GraphQL authentication with passport in https://github.com/nestjs/nest/tree/master/sample
Minimal reproduction of the problem with instructions
N/A
What is the motivation / use case for changing the behavior?
I cannot complete the tutorial.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.