botauth icon indicating copy to clipboard operation
botauth copied to clipboard

Working with Express JS

Open nsantini opened this issue 7 years ago • 2 comments

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!

nsantini avatar May 22 '17 03:05 nsantini

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.

mattdot avatar May 22 '17 17:05 mattdot

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

binhpht avatar Sep 18 '17 12:09 binhpht