microsoftarchive / botauth

Authentication middleware for the botframework
MIT License
72 stars 78 forks source link

Working with Express JS #18

Open nsantini opened 7 years ago

nsantini commented 7 years ago

I raised an issue a few days ago about the bot not being compatible with Express JS. I found that the issue is that the cookie set in the redirect gets lost on the callback (my example is using the Facebook strategy). I forked the repo to work in a solution. What I ended up doing was creating dynamic routes for the botauth endpoints, using the bot user id. For that to work I had to change the behaviour to set the callbackUrl dynamically, which is possible. With that id I was able to store the address in a closure map, that then I was able to retrieve in the callback endpoint. So this worked for me (using express and Facebook strategy). But not sure if it would work for others. I know Restify is not that great handling dynamic routes. If anybody is having the same issue, Im happy to share my solution (or just look at my fork)

Thanks for the hard work on this library, its awesome!

mattdot commented 7 years ago

I think better support of express is a good goal for the next version. Right now I'm directly using the cookie library to implement resumption, but I might just write to session and let express/restify handle that which should give you some more flexibility and normalize the differences between express/restify. Until now I haven't done much testing on express, but for the next major version I'll actually try it out.

binhpht commented 6 years ago

@mattdot Hey, do you do the customer OAuthen for customer website