New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to authenticate to API "Please provide token" #46
Comments
I tested to login to a 1.4.0 with and without trailing slash it it works both. So this seems not to be the root cause. As I'm not able to reproduce the issue locally it is difficult to found the root cause. And if I go to api.py#L72 I can't see a slash there, so I wonder why there is a slash in your module code. I also check the code in the module itselves which comes from pypi.org and there is also no slash in the default value of |
Urgh.. ok. I thought that was it. Here's what I see using python New venv with following packages:
Start of Python and
## Working setup
Request without trailing "/" - successful:
Request with trailing "/" - successful:
Headers
## Non working setup
Request without trailing "/" - UNsuccessful:
Request with trailing "/" - successful:
Headers
Looking at it now. I guess the problem likely lies with Apache/Nginx and/or PHP version differences as opposed to phpIPAM. What versions of PHP, server software are you testing with? |
I test your request cases also against 1.4.0 and 1.4.2 and all cases works against my test environment.
All components running on: CentOS 8.3.2011 |
Ok, then I think we can rule out:
So I guess it's PHP version 5.6 as version 7.x works for me and you... but 5 doesn't work without the trailing slash. I don't have any easy way to test version 5 in a separate environment at the mo but as it's end of support anyway, I suspect the correct answer really then is to simply upgrade to version 7. For now I can work around the problem by manually adjusting api.py to add the trailing slash and in the meantime, I'll push for an upgrade in our production environment. Thanks again for your efforts and support and I look forward to using the Ansible modules now I know where the problem is in my environment :-) |
So I'll close the issue for now. Feel free to reopen it if any new facts raise up. |
Describe the bug
This follows on from https://github.com/codeaffen/phpipam-ansible-modules/discussions/52
Running the
phpypam
module on phpIPAM version 1.4.0 results in an unhandled error. Further debugging shows a HTTP 403 forbidden error with "Please provide token" from phpIPAM.To Reproduce
Example code:
Version 1.40 of phpIPAM used
Expected behavior
With the above code, I expect an output of the configured sections in phpIPAM
Versions:
Additional context
Amending
api.py
in the core package as follows fixes the problem:It appears that from phpIPAM 1.4.1 and above, the trailing "/" is no longer needed. I tested there and it works fine without the trailing "/"
I'm not sure if the above "fix" is the best way to fix the problem. If it is, let me know and I will try creating a pull request for that together with a feature enhancement for undefined errors (display the HTTP error and message).
The text was updated successfully, but these errors were encountered: