Reputation: 749
Hi I am trying to implement password grant strategy with Koa-passport. I configured a strategy as below
passport.use(new PasswordGrantStrategy({
tokenURL: "http://localhost:3001/api/v1/oauth/token",
clientID: "democlient1",
clientSecret: "democlientsecret1",
scope: "profile",
grant_type: "password",
customHeaders: {Authorization: "Basic ZGVtb2NsaWVudDE6ZGVtb2NsaWVudHNlY3JldDE=", scope: "profile" }
},
async (accessToken: string, refreshToken: string, profile: any,
done: (error: any, user?: any, options?: IVerifyOptions) => void) => {
console.log("Details ", accessToken, profile);
done(null, profile);
}));
And this is how i try to authenticate,
return passport.authenticate("password-grant", {
username: "test",
password: "test"
}, (err: any, user: any, info: any, status: any) => {
console.log("Inside Callback method");
})(ctx, next);
Could anyone please help me. The above code does not call the token URL. But the control come inside to the callback method defined in passport.authenticate.
Thanks in advance.
Upvotes: 1
Views: 248