bnoguchi/everyauth — Issue #135: How do I redirect 'back' after a successful login?
Author: czak
Created: 2011-12-14 01:40:03+00:00
State: open

First of, thanks for a great module, adding Github login took me ~5 minutes :)

In my app the **login with Github** button is visible on every page, in the header.
When a user is on `/articles/45` and clicks **login with Github**, I want them to be redirected back to `/articles/45` afterwards. How do I do that?

My config currently redirects to /:

```javascript
everyauth.github
.appId('APP ID')
.appSecret('SECRET')
.findOrCreateUser(function(session, accessToken, accessTokenExtra, githubUserMetadata) {
return githubUserMetadata;
})
.redirectPath('/');
```

I'm thinking about storing the current url in the session (on each request) and redirecting to the last stored one, but maybe there's a cleaner way?