Forums

POST to set SSL details via API failed, got <Response [403]>:{"detail":"You do not have permission to perform this action."} : when performing the final step for letsencrypt setup.

Following the steps here: https://help.pythonanywhere.com/pages/LetsEncrypt/

At the step "Install the certificate", and running the command pa_install_webapp_letsencrypt_ssl.py <my_correctly_typed_domain>

And this is what I get.

Traceback (most recent call last): File "/home/idkfa/.local/bin/pa_install_webapp_letsencrypt_ssl.py", line 71, in <module> suppress_reload=arguments.get('--suppress-reload') File "/home/idkfa/.local/bin/pa_install_webapp_letsencrypt_ssl.py", line 41, in main webapp.set_ssl(certificate, private_key) File "/home/idkfa/.local/lib/python3.6/site-packages/pythonanywhere/api.py", line 167, in set_ssl response_text=response.text, Exception: POST to set SSL details via API failed, got <Response [403]>:{"detail":"You do not have permission to perform this action."}

So close, and yet so far away....

It probably has something to do with the fact that I'm using GoDaddy for a custom domain, but I'm not sure what I need to do differently there.

Did you start a fresh Bash console to run the commands after you enabled the API? From the error message, it looks like the script is trying to use an invalid API token. Try running the command again in a new bash console and see if that helps.

Just ran a fresh bash console. Same error.

Hmm, from our logs it looks like the domain name you're using isn't correct -- it needs to match exactly what you have on the "Web" tab. So, for example, if you have "www.yourdomain.com" there then it needs to be that on the command line -- "yourdomain.com" without the "www." won't work.

That was it... I love you guys so much, PythonAnywhere crew....

Glad we could help!