Skip to main content

WHM API returns Token denied

Comments

5 comments

  • cPanelKenneth
    Hi, How are you submitting the token via the browser? Also, please link the documentation you and following, and what is the version number of cPanel & WHM you are using?
    0
  • Ramize Attia
    Hi, Yes, I am submitting through the browser. This is the documentation I am following: WHM API 1 Functions - createacct - Software Development Kit - cPanel Documentation
    0
  • cPanelKenneth
    Hi, How are you submitting the token via the browser? Are you adding it to the Authorization header? Are you appending it to the URL? Is there another method you are using? Which version of cPanel & WHM are you using?
    0
  • Ramize Attia
    What I do is to change the values in the given URL to my actual values https://hostname.example.com:2087/cpsess##########/json-api/createacct?api.version=1&username=user&domain=example.com&plan=package_name&featurelist=default&quota=0&password=12345luggage&ip=n&cgi=1&hasshell=1&contactemail=user%40seconddomain.com&cpmod=paper_lantern&maxftp=5&maxsql=5&maxpop=10&maxlst=5&maxsub=1&maxpark=1&maxaddon=1&bwlimit=500&language=en&useregns=1&hasuseregns=1&reseller=0&forcedns=1&mailbox_format=mdbox&mxcheck=local&max_email_per_hour=500&max_defer_fail_percentage=80&owner=root
    I also try https://hostname.example.com:2087/cpsess##########/json-api/createacct?api.version=1
    and just paste in the browser and then it gives me this error. {"cpanelresult":{"apiversion":"2","error":"Token denied","data":{"reason":"Token denied","result":"0"},"type":"text"}}
    No other way, that's the only way I am using now, because I want to make sure it's working before implementing my code. I am using version: 64.0.25
    0
  • cPanelKenneth
    Hi, Thank you for the information. API Token authentication doesn't work via the browser, at least not without using dev tools to modify the request headers. When you submit your test URL the browser should either use your existing session or exit with an error like: "cpanelresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}
    Information about using API tokens is in our Guide to API Authentication - API Tokens - Software Development Kit - cPanel Documentation guide. The fact your error message is reporting a problem with the token suggests something else is wrong. Did you happen to mean version 68.0.25? We didn't publish 64.0.25.
    0

Please sign in to leave a comment.