Can you log in a user from an external link using ember-simple-auth?

Hi,

This seems like a really common use case, which usually means there’s a well-known solution (or two or three or…), but if there is, I can’t find it. I have around a dozen browser tabs open and my head is spinning, so I thought I’d just bite the bullet and ask. And since this is common, perhaps it will help others as well.

Common Use Case: Email to user contains a link to your site. When you click the link you want to whisk them to the correct page… and have them already logged in, so they don’t have to visit the login page first, enter their username and password, and then be taken to the desired page.

In my case I have a Rails back end and am using ember-simple-auth for authentication. (BTW: thanks for the great add-on!)

I know that in the “typical” process the user sends the login credentials (e.g. username and password) to the server, and, if valid, gets back some JSON containing an authentication token, that is then sent up (along with the username) in the request header for all subsequent requests.

Back to my “somewhat typical” email-with-a-link: in my Rails back end I can process the link and do a redirect_to to the proper page. As this is the essentially the first request, the ember app gets sent down in its entirety. The correct page (thanks to the excellent routing ember provides) gets displayed… but there is no current, logged-in user.

So I am trying to figure out how to get the initial rendering of my ember app to automatically have a logged-in, current user - specifically, so he can see authenticated-user-only controls on the page that is displayed.

It would be great if I could specify an addition to the request header along with the redirect_to => I could add something like Authorization Token token="123abc", username="joe", but you can’t do that.

So, is there a way to do this? If I’m missing something obvious, please don’t laugh. :slight_smile: