Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

cPanel API Authentication questions

Discussion in 'cPanel Developers' started by Marani, Aug 6, 2018.

  1. Marani

    Marani Member

    Joined:
    Nov 23, 2015
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Iran
    cPanel Access Level:
    Website Owner
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,212
    Likes Received:
    159
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    HI @Marani

    The tokens are only available to be used with WHMAPI Functions, DNS Clustering, and configuration Clusters at this time per our documentation here:
    Manage API Tokens - Version 74 Documentation - cPanel Documentation

    Furthermore, it's only valid for the root user or a reseller user as indicated here:
    Guide to API Authentication - API Tokens - Developer Documentation - cPanel Documentation

    To do what you're requesting it sounds like you'll need to use one of the other authentication methods available.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Marani

    Marani Member

    Joined:
    Nov 23, 2015
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Iran
    cPanel Access Level:
    Website Owner
    Hi Lauren,

    I believe you are talking about API token here, right?
    Guide to API Authentication - Developer Documentation - cPanel Documentation

    If yes, then, API token method is not for cPanel, so how do I generate cpsess (security token) with API? I need this to get authenticated to cPanel.

    If I log in using web browser I see cpsess generated in the address bar. I just don't want to use any browser-based action in my software that I'm coding.

    Are you familiar with POSTMAN? I do tests using postman.

    Thanks
     
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,212
    Likes Received:
    159
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Marani

    As I indicated in my last response, no API token Authentication is not for cPanel it will only work for WHM i.e. the root user or a reseller.

    The only suitable method I can think of that wouldn't be browser based would be Guide to API Authentication - Secure Remote Logins - Developer Documentation - cPanel Documentation

    There is a list of suitable authentication methods at the bottom of the page here: Guide to API Authentication - Developer Documentation - cPanel Documentation

     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Marani

    Marani Member

    Joined:
    Nov 23, 2015
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Iran
    cPanel Access Level:
    Website Owner
    Secure Remote Login seems to need a PHP coding, which I don't know. I want to C#.
    The second link is the same authentication methods I posted in the first post.

    I wanted to create a file uploader in C# everything is done and works correctly except the first step which is to get cpsess (given after logging in via the browser).
     
  6. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,212
    Likes Received:
    159
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    HI @Marani

    If you read through and looked at the example, you'd see it was actually using a perl script as an example. As long as the Cpanel::LogMeIn module was able to be called this would work.

    Yes, I am aware of that, I was just making a reference to the available authentication methods, as you can see from the quoted text. These are what is available

    If you don't know how to use any of the authentication methods available with your project you may want to look at enlisting the assistance of a developer that may be able to help you integrate one of them into your project. You might find some help here: System Administration Services | cPanel Forums though this is geared more toward system administrators. `
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Marani

    Marani Member

    Joined:
    Nov 23, 2015
    Messages:
    15
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Iran
    cPanel Access Level:
    Website Owner
    Hi @cPanelLauren

    I have no idea how I forgot that I have written the authentication some time ago. I found it last night between source code files, tested it and it works perfectly. it was simple and needed none of the sample codes in the documentation.

    Now I can the most of cPanel API 2 and UAPI functions.

    Thanks
     
    cPanelLauren likes this.
  8. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,212
    Likes Received:
    159
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Marani


    Well, that's a really nice find!! I'm glad the issue is sorted and you can use the API and UAPI as you initially intended now :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice