Skip to content
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

[Solved]Unauthorized Error #28

Open
Uzzi opened this issue Jul 21, 2020 · 2 comments
Open

[Solved]Unauthorized Error #28

Uzzi opened this issue Jul 21, 2020 · 2 comments

Comments

@Uzzi
Copy link

Uzzi commented Jul 21, 2020

I'm tring to execute api-example.php, thi si error:
PHP Notice: Array to string conversion in /var/www/html/phpipam/functions/classes/class.phpipam-api.php on line 652
PHP Notice: Undefined variable: response_headers in /var/www/html/phpipam/functions/scripts/api-test.php on line 26
Array
(
[code] => 401
[success] =>
[message] => Unauthorized
[time] => 0.024
)

Can you help me?
Regards

@Uzzi Uzzi changed the title Unauthorized Error [Solved]Unauthorized Error Jul 21, 2020
@Uzzi
Copy link
Author

Uzzi commented Jul 21, 2020

modify $api_key = false; working on SSL

@Damodara1687
Copy link

Damodara1687 commented Feb 27, 2023

Hello,

i have the Same Problem, but removing the api key and adding credentials , dont help, is the selfsigned certificate the problem?

`URL: "https://172.24.0.12/api"
APP-ID: "nmaper"
api-key: ""

  • Trying 172.24.0.12:443...
  • Connected to 172.24.0.12 (172.24.0.12) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/nginx/ssl/mozilla-extracted.pem
  • CApath: /etc/ssl/certs
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
  • ALPN, server accepted to use http/1.1
  • Server certificate:
  • subject: CN=pphpipam.westerwald.local; C=DE; ST=Rehinland-Pfalz; L=Oberlahr; O=Yoga Vidya e.v. Westerwald; OU=Technik
  • start date: Feb 26 23:33:02 2023 GMT
  • expire date: Feb 23 23:33:02 2033 GMT
  • issuer: CN=internal-ca; C=DE; ST=Rehinland-Pfalz; L=Oberlahr; O=Yoga Vidya e.v. Westerwald; OU=Technik
  • SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

POST /api/nmaper/user/ HTTP/1.1
Host: 172.24.0.12
User-Agent: phpipam-api php class
Accept: /
Transfer-Encoding: chunked
Content-Length: 0
Authorization: Basic YWRtaW46MWp6NHExMHh5
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 100 Continue
  • Signaling end of chunked upload via terminating chunk.
  • Mark bundle as not supporting multiuse
    < HTTP/1.1 401 Unauthorized
    < Server: nginx/1.18.0
    < Date: Mon, 27 Feb 2023 23:59:20 GMT
    < Content-Type: application/json; charset=utf-8
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Set-Cookie: ipa_snvbh67=1ieflmkscc593vg0iash2dtrgm; expires=Tue, 28 Feb 2023 23:59:20 +0000; Max-Age=86400; path=/; SameSite=Lax; HttpOnly;
    < Location: /api//user/
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Vary: Accept-Encoding
    <
  • Connection #0 to host 172.24.0.12 left intact
  • Trying 172.24.0.12:443...
  • Connected to 172.24.0.12 (172.24.0.12) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/nginx/ssl/mozilla-extracted.pem
  • CApath: /etc/ssl/certs
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
  • ALPN, server accepted to use http/1.1
  • Server certificate:
  • subject: CN=pphpipam.westerwald.local; C=DE; ST=Rehinland-Pfalz; L=Oberlahr; O=Yoga Vidya e.v. Westerwald; OU=Technik
  • start date: Feb 26 23:33:02 2023 GMT
  • expire date: Feb 23 23:33:02 2033 GMT
  • issuer: CN=internal-ca; C=DE; ST=Rehinland-Pfalz; L=Oberlahr; O=Yoga Vidya e.v. Westerwald; OU=Technik
  • SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

POST /api/nmaper/user/ HTTP/1.1
Host: 172.24.0.12
User-Agent: phpipam-api php class
Accept: /
Transfer-Encoding: chunked
Content-Length: 0
Authorization: Basic YWRtaW46MWp6NHExMHh5
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 100 Continue
  • Signaling end of chunked upload via terminating chunk.
  • Mark bundle as not supporting multiuse
    < HTTP/1.1 401 Unauthorized
    < Server: nginx/1.18.0
    < Date: Mon, 27 Feb 2023 23:59:20 GMT
    < Content-Type: application/json; charset=utf-8
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Set-Cookie: ipa_snvbh67=2brcg31v0bbcbj8egmlku9jltu; expires=Tue, 28 Feb 2023 23:59:20 +0000; Max-Age=86400; path=/; SameSite=Lax; HttpOnly;
    < Location: /api//user/
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Vary: Accept-Encoding
    <
  • Connection #0 to host 172.24.0.12 left intact
    Array
    (
    [code] => 401
    [success] =>
    [message] => Unauthorized
    [time] => 0.001
    )
    `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants