Skip to main content

cPanel API authentication with security token

Comments

11 comments

  • weeming21
    try xmlapi.php
    0
  • Satish Dongol
    try xmlapi.php
    0
  • cPanelMichael
    Hello, The following document is a good place to start:
    0
  • AndrewH.
    If you have already authenticated and generated your security token the API calls should just work. Use the API shell in either WHM or cPanel to see what the urls generated for API calls are but it should be a near drop in replacement. Ex: API shell will generate this as the url:
    /execute/Branding/include
    With this you just need $serverurl:2083/$sessionToken/$url so the API call is this:
    https://mytestserver.com:2083/cpsess123456/execute/Branding/include
    0
  • Satish Dongol
    Hello, The following document is a good place to start:
    0
  • Satish Dongol
    If you have already authenticated and generated your security token the API calls should just work. Use the API shell in either WHM or cPanel to see what the urls generated for API calls are but it should be a near drop in replacement. Ex: API shell will generate this as the url:
    /execute/Branding/include
    With this you just need $serverurl:2083/$sessionToken/$url so the API call is this:
    https://mytestserver.com:2083/cpsess123456/execute/Branding/include

    Thanks for the response. I have generated the security token by using the cPanel's loginmein class for PHP. I first generated the logged in URL from the script found here: gist.github.com/kmark/4440574. From that URL I extracted the security token. Now my problem is that, if I load the URL generated by the script then I can use the security token to make API calls, but since I am just extracting the security token from the URL it is giving me "Access Denied" error. This is because the cookies of the cPanel is not being created. Could you help me further based on the above mentioned details?
    0
  • Satish Dongol
    Hello, The following document is a good place to start:
    0
  • rajdshah
    Hello, Why do you need security token when you're trying to access cPanel API? REST calls works without any security token. Which programming language are you using? PHP or something else?
    0
  • Darma
    Hi guys, Sorry to jump here, but how can I generate that security token. I have tried several solutions I have found everywhere, but I cannot manage. I can login well. I need to get the security token and redirect user to the awstat page of his website. Thanks for any help you can give me. Kind regards, Darma
    0
  • cPanelMichael
    Sorry to jump here, but how can I generate that security token. I have tried several solutions I have found everywhere, but I cannot manage. I can login well.

    Could you elaborate on the type of script you are using, and what methods you have tried thus far? Is the
    0
  • mer30boy
    hi i want to use the PHP script to remotely login to the cpanel account and generate a security token from it. do you have a php example ?
    0

Please sign in to leave a comment.