node.js - KOA - Passport with Password Grant strategy -


hi trying implement password grant strategy koa-passport. configured strategy 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 how try 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 please me. above code not call token url. control come inside callback method defined in passport.authenticate.

thanks in advance.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -