API: Login as another user

jeroenpeters

Verified User
Joined
Apr 10, 2013
Messages
5
Hi guys,

I would like to create an API call that allows me to login as another user. Kind of like a single sign on thing, so people will be able to login with a simple click.
A starting point to this is Login Keys I think, but am not sure I can create Login Keys for another user.

Is there any way I can create the "Login as ..." functionality with the API?

I hope somebody know.

Kind regards,

Jeroen Peters
 
If you have a super-user (admin), I believe you can use the admin|other-username login syntax to become the other user, for which you can then create a login key.

So:

1. Generate long-time login key for admin
2. Use admin|other-user with login key to access API
3. Create login key for other-user through API you just accessed.
4. Redirect them to login form of your own, with their username and login key you generated pre-filled (and auto-submit form using JS if you feel super fancy).
 
Cool. I've done something similar using my Ruby gem for accessing DirectAdmin to create my login federation page.

Nice! Cool that you provide the gem too :) I don't have experience with Ruby for Python there is a lib, but only Python 2.x compatible. It's not developed anymore so I am trying to create a Python3 one. Thanks for your help, if the login worked, I'll post it here
 
Back
Top