Results 1 to 6 of 6

Thread: API: Login as another user

  1. #1
    Join Date
    Apr 2013
    Posts
    5

    API: Login as another user

    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

  2. #2
    Join Date
    Feb 2016
    Posts
    48
    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).

  3. #3
    Join Date
    Apr 2013
    Posts
    5

    Talking

    Hi Adam, thanks! Offcourse, I didn't think of becoming the other client by getting admin|clientname.. Silly of me..

    I think that might be it!

    I am working on https://bitbucket.org/jeroenpeters/python-directadmin3 to create a Python3 DA plugin :-)

    Thanks again!

  4. #4
    Join Date
    Apr 2013
    Posts
    5
    And if other people fiind this topic: there's more to submitting a client to a directadmin page from an external site: https://help.directadmin.com/item.php?id=498

  5. #5
    Join Date
    Feb 2016
    Posts
    48
    Cool. I've done something similar using my Ruby gem for accessing DirectAdmin to create my login federation page.

  6. #6
    Join Date
    Apr 2013
    Posts
    5
    Quote Originally Posted by adam12 View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •