ciaranj / connect-auth

Authentication middleware for connect.
MIT License
813 stars 114 forks source link

authenticateUser() should pass results of associateTokenToUser() to callback #104

Closed evanp closed 12 years ago

evanp commented 12 years ago

The authenticateUser() method of the OAuthServices class was returning the results of provider.authenticateUser() instead of provider.associateTokenToUser().

This gives incorrect results if associateTokenToUser() doesn't return the identical object (the in-memory provider does, which is probably why this doesn't come up).

This patch changes the function so that if associateTokenToUser() returns a non-identical object (say, if you use a database) you get the most up-to-date object back.