PHP Classes

Polar API error 403

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Polar API error 403  >  (Un) Subscribe thread alerts  
Subject:Polar API error 403
Summary:login_with_polar.php 403
Messages:6
Author:Boris guerard
Date:2021-02-18 21:40:38
 

  1. Polar API error 403   Reply   Report abuse  
Picture of Boris guerard Boris guerard - 2021-02-18 21:40:38
Hi,

I try to use login_with_polar.php

After getting Authorization code, I have this error when CallAPI try https://www.polaraccesslink.com/v3/users/{$user_id}

Error: it was not possible to access the API call: it was returned an unexpected response status 403 Response:

An idea of ​​what I could have done wrong ?

Thank you

Boris


  2. Re: Polar API error 403   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-02-19 04:05:08 - In reply to message 1 from Boris guerard
Hello Boris,

Can you please enable the error logging and reply here with the log messages that do not contain sensitive data, so I can analyse the problem?

You can do that by setting the class variable to true and then the log_file_name variable to the path of a local file in your PHP environment.

  3. Re: Polar API error 403   Reply   Report abuse  
Picture of Boris guerard Boris guerard - 2021-02-19 20:46:39 - In reply to message 2 from Manuel Lemos
Hello Manuel,

Here's my log:

OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php?state=1613764977-f52ed6&code=e92b6e2f818bfe4801415b8951ef1ef5
OAuth client: Checking the authentication state
OAuth client: The authentication state is not valid.
OAuth client: Redirecting to OAuth Dialog https://flow.polar.com/oauth2/authorization?response_type=code&scope=accesslink.read_all&client_id=MyCLIENTID&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&state=1613765340-4893c3
OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php?state=1613765340-4893c3&code=429f127c3ddc20f6f192a1f48b60cd81
OAuth client: Checking the authentication state
OAuth client: Checking the authentication code
OAuth client: Accessing the OAuth access token at https://polarremote.com/v2/oauth2/token
Connecting to polarremote.com
Resolving HTTP server domain "polarremote.com"...
Connecting to HTTP server IP 62.165.171.26 port 443...
Connected to polarremote.com
C POST /v2/oauth2/token HTTP/1.1
C Host: polarremote.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: */*
C Authorization: Basic NTIzYjZiMjQtMzNmNS00ZGFiLWIyOWQtZGFjNDIwNWY5Nzk5OjM0ZWQ5YzU0LTg0NDEtNDI1ZC04Y2M0LTAxZjE0YmY2ZGI1ZA==
C Connection: Keep-Alive
C Content-Type: application/x-www-form-urlencoded
C Content-Length: 149
C
C code=429f127c3ddc20f6f192a1f48b60cd81&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&grant_type=authorization_code
S HTTP/1.1 200 OK
S Date: Fri, 19 Feb 2021 20:09:00 GMT
S Polar-Correlation-Id: 83667710-d94b-4bf1-bafb-caf0d35adb01
S Access-Control-Allow-Origin: *
S Access-Control-Allow-Credentials: true
S Access-Control-Expose-Headers: Content-Length
S Cache-Control: no-cache, no-store, must-revalidate
S Pragma: no-cache
S Expires: Thu, 01 Jan 1970 00:00:00 GMT
S Content-Type: application/json;charset=utf-8
S Transfer-Encoding: chunked
S Set-Cookie: NSC_ued1-qspe-sfnpuf-mc=ffffffffc3a0985b45525d5f4f58455e445a4a4229a0;path=/;secure;httponly
S
S 75
S {"access_token":"7a6d408e26aaddc12d1ea4432e51c74a","token_type":"bearer","expires_in":461375999,"x_user_id":MyUSERID}
S 0
S
Keeping the connection alive to polarremote.com
OAuth client: Access token: 7a6d408e26aaddc12d1ea4432e51c74a
OAuth client: Access token expiry: 2035-10-04 20:08:59 UTC
OAuth client: Access token type: bearer
OAuth client: Accessing the API call at https://www.polaraccesslink.com/v3/users/MyUSERID
Connecting to www.polaraccesslink.com
Resolving HTTP server domain "www.polaraccesslink.com"...
Connecting to HTTP server IP 62.165.171.217 port 443...
Connected to www.polaraccesslink.com
C GET /v3/users/MyUSERID HTTP/1.1
C Host: www.polaraccesslink.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: application/json
C Authorization: Bearer 7a6d408e26aaddc12d1ea4432e51c74a
C Connection: Keep-Alive
C
S HTTP/1.1 403
S Polar-Correlation-Id: e5902d49-5e73-4f62-8a68-d7d1a3f74efd
S RateLimit-Usage: 8, 8
S RateLimit-Limit: 500, 5000
S RateLimit-Reset: 198, 85698
S Content-Length: 0
S Date: Fri, 19 Feb 2021 20:09:01 GMT
S Set-Cookie: NSC_eob1-qspe-xxb-mc-ttm=ffffffffc3a0949545525d5f4f58455e445a4a4229a9;path=/;secure;httponly
S
Disconnected from www.polaraccesslink.com
OAuth client: Could not retrieve the OAuth access token. Error: it was not possible to access the API call: it was returned an unexpected response status 403 Response:
OAuth client: Resetting the access token status for OAuth server located at https://polarremote.com/v2/oauth2/token
OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php?state=1613765340-4893c3&code=429f127c3ddc20f6f192a1f48b60cd81
OAuth client: Checking the authentication state
OAuth client: The authentication state is not valid.
OAuth client: Redirecting to OAuth Dialog https://flow.polar.com/oauth2/authorization?response_type=code&scope=accesslink.read_all&client_id=MyCLIENTID&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&state=1613766131-c3bfd2
OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php?state=1613766131-c3bfd2&code=d531aea76699461be8a71632eb361da2
OAuth client: Checking the authentication state
OAuth client: Checking the authentication code
OAuth client: Accessing the OAuth access token at https://polarremote.com/v2/oauth2/token
Connecting to polarremote.com
Resolving HTTP server domain "polarremote.com"...
Connecting to HTTP server IP 62.165.171.211 port 443...
Connected to polarremote.com
C POST /v2/oauth2/token HTTP/1.1
C Host: polarremote.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: */*
C Authorization: Basic NTIzYjZiMjQtMzNmNS00ZGFiLWIyOWQtZGFjNDIwNWY5Nzk5OjM0ZWQ5YzU0LTg0NDEtNDI1ZC04Y2M0LTAxZjE0YmY2ZGI1ZA==
C Connection: Keep-Alive
C Content-Type: application/x-www-form-urlencoded
C Content-Length: 149
C
C code=d531aea76699461be8a71632eb361da2&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&grant_type=authorization_code
S HTTP/1.1 200 OK
S Date: Fri, 19 Feb 2021 20:22:12 GMT
S Polar-Correlation-Id: 0f4c784b-74ad-4ce3-aa40-f5b74c5fd030
S Access-Control-Allow-Origin: *
S Access-Control-Allow-Credentials: true
S Access-Control-Expose-Headers: Content-Length
S Cache-Control: no-cache, no-store, must-revalidate
S Pragma: no-cache
S Expires: Thu, 01 Jan 1970 00:00:00 GMT
S Content-Type: application/json;charset=utf-8
S Transfer-Encoding: chunked
S Set-Cookie: NSC_eob1-qspe-sfnpuf-mc=ffffffffc3a0945c45525d5f4f58455e445a4a4229a0;path=/;secure;httponly
S
S 75
S {"access_token":"79bd711057da9fc8c26d1dfc9cf47282","token_type":"bearer","expires_in":461375999,"x_user_id":MyUSERID}
S 0
S
Keeping the connection alive to polarremote.com
OAuth client: Access token: 79bd711057da9fc8c26d1dfc9cf47282
OAuth client: Access token expiry: 2035-10-04 20:22:11 UTC
OAuth client: Access token type: bearer
OAuth client: Accessing the API call at https://www.polaraccesslink.com/v3/users/MyUSERID
Connecting to www.polaraccesslink.com
Resolving HTTP server domain "www.polaraccesslink.com"...
Connecting to HTTP server IP 62.165.171.31 port 443...
Connected to www.polaraccesslink.com
C GET /v3/users/MyUSERID HTTP/1.1
C Host: www.polaraccesslink.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: application/json
C Authorization: Bearer 79bd711057da9fc8c26d1dfc9cf47282
C Connection: Keep-Alive
C
S HTTP/1.1 403
S Polar-Correlation-Id: f13e0f6a-9e9b-44a3-880c-a12a376b9e68
S RateLimit-Usage: 1, 9
S RateLimit-Limit: 500, 5000
S RateLimit-Reset: 899, 84907
S Content-Length: 0
S Date: Fri, 19 Feb 2021 20:22:12 GMT
S Set-Cookie: NSC_ued1-qspe-xxb-mc-ttm=ffffffffc3a0989545525d5f4f58455e445a4a4229a9;path=/;secure;httponly
S
Disconnected from www.polaraccesslink.com
OAuth client: Could not retrieve the OAuth access token. Error: it was not possible to access the API call: it was returned an unexpected response status 403 Response:
OAuth client: Resetting the access token status for OAuth server located at https://polarremote.com/v2/oauth2/token
OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php
OAuth client: Checking the authentication state
OAuth client: The authentication state value was not passed by the OAuth server.
OAuth client: The authentication state is not valid.
OAuth client: Redirecting to OAuth Dialog https://flow.polar.com/oauth2/authorization?response_type=code&scope=accesslink.read_all&client_id=MyCLIENTID&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&state=1613766399-9a30a5
OAuth client: Checking if OAuth access token was already retrieved from https://polarremote.com/v2/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the authentication state from URI /MyPath/login_with_polar.php?state=1613766399-9a30a5&code=ba754d089bbe542cee55a833b0657efb
OAuth client: Checking the authentication state
OAuth client: Checking the authentication code
OAuth client: Accessing the OAuth access token at https://polarremote.com/v2/oauth2/token
Connecting to polarremote.com
Resolving HTTP server domain "polarremote.com"...
Connecting to HTTP server IP 62.165.171.211 port 443...
Connected to polarremote.com
C POST /v2/oauth2/token HTTP/1.1
C Host: polarremote.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: */*
C Authorization: Basic NTIzYjZiMjQtMzNmNS00ZGFiLWIyOWQtZGFjNDIwNWY5Nzk5OjM0ZWQ5YzU0LTg0NDEtNDI1ZC04Y2M0LTAxZjE0YmY2ZGI1ZA==
C Connection: Keep-Alive
C Content-Type: application/x-www-form-urlencoded
C Content-Length: 149
C
C code=ba754d089bbe542cee55a833b0657efb&redirect_uri=https%3A%2F%2FMyurl%2Flogin_with_polar.php&grant_type=authorization_code
S HTTP/1.1 200 OK
S Date: Fri, 19 Feb 2021 20:26:48 GMT
S Polar-Correlation-Id: f63e0ac1-cfd8-414a-9893-e4d9f60bd2a3
S Access-Control-Allow-Origin: *
S Access-Control-Allow-Credentials: true
S Access-Control-Expose-Headers: Content-Length
S Cache-Control: no-cache, no-store, must-revalidate
S Pragma: no-cache
S Expires: Thu, 01 Jan 1970 00:00:00 GMT
S Content-Type: application/json;charset=utf-8
S Transfer-Encoding: chunked
S Set-Cookie: NSC_eob1-qspe-sfnpuf-mc=ffffffffc3a0945b45525d5f4f58455e445a4a4229a0;path=/;secure;httponly
S
S 75
S {"access_token":"0295676b60d79afa17d987435de8b402","token_type":"bearer","expires_in":461375999,"x_user_id":MyUSERID}
S 0
S
Keeping the connection alive to polarremote.com
OAuth client: Access token: 0295676b60d79afa17d987435de8b402
OAuth client: Access token expiry: 2035-10-04 20:26:47 UTC
OAuth client: Access token type: bearer
OAuth client: Accessing the API call at https://www.polaraccesslink.com/v3/users/MyUSERID
Connecting to www.polaraccesslink.com
Resolving HTTP server domain "www.polaraccesslink.com"...
Connecting to HTTP server IP 62.165.171.217 port 443...
Connected to www.polaraccesslink.com
C GET /v3/users/MyUSERID HTTP/1.1
C Host: www.polaraccesslink.com
C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.170 $)
C Accept: application/json
C Authorization: Bearer 0295676b60d79afa17d987435de8b402
C Connection: Keep-Alive
C
S HTTP/1.1 403
S Polar-Correlation-Id: ce1c623e-e487-4806-82f2-0375fa4ed073
S RateLimit-Usage: 2, 10
S RateLimit-Limit: 500, 5000
S RateLimit-Reset: 624, 84631
S Content-Length: 0
S Date: Fri, 19 Feb 2021 20:26:47 GMT
S Set-Cookie: NSC_eob1-qspe-xxb-mc-ttm=ffffffffc3a0949545525d5f4f58455e445a4a4229a9;path=/;secure;httponly
S
Disconnected from www.polaraccesslink.com
OAuth client: Could not retrieve the OAuth access token. Error: it was not possible to access the API call: it was returned an unexpected response status 403 Response:
OAuth client: Resetting the access token status for OAuth server located at https://polarremote.com/v2/oauth2/token



  4. Re: Polar API error 403   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-02-20 05:22:45 - In reply to message 3 from Boris guerard
It seems you are sending an API call request to this URL:

polaraccesslink.com/v3/users/MyUSER ...

Can you try replacing the MyUSERID part with the identifier number of a real user?

  5. Re: Polar API error 403   Reply   Report abuse  
Picture of Boris guerard Boris guerard - 2021-02-20 09:57:31 - In reply to message 4 from Manuel Lemos
I sent with a real ID.

MyuserID is only in this message (I modify the log to hide my personal information)

  6. Re: Polar API error 403   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-08-13 03:11:33 - In reply to message 5 from Boris guerard
Hello Boris,

Sorry for the delay. I missed this message. Do you still need help?