-
Notifications
You must be signed in to change notification settings - Fork 13
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
Connection error #32
Comments
Hi @tedatkc When looking at the response |
Sorry -- I should have caught that. Still getting problems. Here is what I ran. I ran the two options for the redirect URI and still had problems. Looks like it is not even getting to the callback? #DOMAIN='https://digitalassets.kimberly-clark.com' DOMAIN='digitalassets.kimberly-clark.com' #REDIRECT_URI='https://localhost/callback' REDIRECT_URI='localhost/callback' bynder_client = BynderClient( domain=DOMAIN, redirect_uri=REDIRECT_URI, client_id=CLIENTID, client_secret=CLIENTSECRET, scopes=['offline', 'asset:read', 'meta.assetbank:read'], ) print(bynder_client.get_authorization_url()) code = input('Code: ') bynder_client.fetch_token(code) asset_bank_client = bynder_client.asset_bank_client media_list = asset_bank_client.media_list({ 'limit': 2, 'type': 'image' }) Here is the response (with some replaced text): ('https://digitalassets.[my_DOMAIN].com/v6/authentication/oauth2/auth?response_type=code&client_id=[my_CLIENTID]&redirect_uri=localhost%2Fcallback&scope=offline+asset%3Aread+meta.assetbank%3Aread&state=1IDz48tG', '1IDz48tG') Code: 1IDz48tG Traceback (most recent call last): File "[my_environment]byndersdk\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "[my_environment]byndersdk\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "[my_environment]byndersdk\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn conn.connect() File "[my_environment]byndersdk\lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrap_socket( File "[my_environment]byndersdk\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl( File "[my_environment]byndersdk\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "[my_environment]byndersdk\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "[my_environment]byndersdk\lib\ssl.py", line 1071, in _create self.do_handshake() File "[my_environment]byndersdk\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "[my_environment]byndersdk\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "[my_environment]byndersdk\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "[my_environment]byndersdk\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) MaxRetryError: HTTPSConnectionPool(host='digitalassets.[my_DOMAIN].com', port=443): Max retries exceeded with url: /v6/authentication/oauth2/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "[my_environment]byndersdk\lib\site-packages\spyder_kernels\py3compat.py", line 356, in compat_exec exec(code, globals, locals) File "c:\users\[my_UID]\onedrive - [my_DOMAIN]\projects\2022\fia\gre03327-40020\bynder\test\getting_started_ted.py", line 104, in bynder_client.fetch_token(code) File "[my_environment]byndersdk\lib\site-packages\bynder_sdk\client\bynder_client.py", line 58, in fetch_token return self.session.fetch_token( File "[my_environment]byndersdk\lib\site-packages\bynder_sdk\oauth2.py", line 34, in fetch_token return super().fetch_token( File "[my_environment]byndersdk\lib\site-packages\requests_oauthlib\oauth2_session.py", line 341, in fetch_token r = self.request( File "[my_environment]byndersdk\lib\site-packages\requests_oauthlib\oauth2_session.py", line 521, in request return super(OAuth2Session, self).request( File "[my_environment]byndersdk\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "[my_environment]byndersdk\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "[my_environment]byndersdk\lib\site-packages\requests\adapters.py", line 563, in send raise SSLError(e, request=request) SSLError: HTTPSConnectionPool(host='digitalassets.[my_DOMAIN].com', port=443): Max retries exceeded with url: /v6/authentication/oauth2/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) |
@tedatkc are you using a vpn or some sort of proxy? This generally leads to ssl errors. We tested the sdk a little while ago and it is working correctly. So if you are still facing the same issue I would recommend doing a clean-up of your python environment,re-importing the package and retrying. Here is a thread for a similar issue that might be of help https://discuss.python.org/t/ssl-certificate-verify-failed-certificate-verify-failed-self-signed-certificate/14359 |
Hey @tedatkc we were informed that you reached out to support about this. I want to reiterate on the fact that you please make use of the sdk methods to make calls and not setup your own session with the But looks to me that there is something missing with your ssl permissions or vpn tunneling(if you are using one). We do not have a specific ssl certificate that we need the clients to patch during usage. Like the thread above you might find a solution for the ssl issue/tunneling in a stackoverflow thread with some digging around. |
My only purpose in using requests was to discover if something was wrong on my end. I discovered that my SSL certificates were wrong (being a newbie to SSL). That has now been corrected. Yay! I'm only trying to use the most basic example -- nothing exotic, nothing outside of your "getting started" documentation. I've been trying to make use the example app.py and sdk methods trying to get things to work. The code earlier in this chain (and issue #31) was right from the documentation. I now get: MissingTokenError: (missing_token) Missing access token parameter, from the bynder_client.fetch_token(code) call. print(bynder_client.get_authorization_url()) By the way, it's not clear from the documentation what I'm supposed to enter in as "Code:". The get_authorization_url() call returns a 2-tuple with the URL request and a short string. Is that what is supposed to be entered as the 'Code'? The short string? Thank you! |
Per Eric on Support 160448, I've been asked to follow up here. He also instructed me to paste the URL from the get_authorization_url() into a browser to get the code. ('https://digitalassets.kimberly-clark.com/v6/authentication/oauth2/auth?response_type=code&client_id=[MYCLIENTID]&redirect_uri=https%3A%2F%2Flocalhost%2Fcallback&scope=offline+asset%3Aread+meta.assetbank%3Aread&state=0NIKLWkx', '0NIKLWkx') |
Hi @tedatkc Would you be able to enable the support feature in the portal so that we can have a look at your OAuth2 app setup? The error that you receive is most likely due to the setup of the client in the portal. https://support.bynder.com/hc/en-us/articles/360013934239-Grant-Bynder-Access-to-Your-Portal The code that you need to generate a token is returned after you complete the login challenge after running a successful "Authorize Application". Please refer to our API documentation for more information, https://bynder.docs.apiary.io/#reference/oauth-2.0/authorize-endpoint/authorize-application This error "I now get: MissingTokenError: (missing_token) Missing access token parameter, from the bynder_client.fetch_token(code) call." is returned because the example is trying to to an API requests while you have not setup an Access token yet. For an OAuth2 APP - https://support.bynder.com/hc/en-us/articles/360013875180-Create-your-OAuth-Apps Once you've the OAuth2 setup correctly you can go ahead and configure the app.py file. Like my example below. Once you've configured your domain, redirect_URI, client_id, client_secret, scopes you can run the code. Which will return a link that you need to open in your browser. After doing the login challenge you will be redirected to your redirectURI. That URI will have the After you copy and paste the code and run it, an Access Token will be generated which can be setup at the token on line 16 of the Example app. All of these steps are standardised OAuth2 protocols, you can always refer to our documentation in regards to OAuth2 https://bynder.docs.apiary.io/#reference/oauth-2.0/ This information should get you on your way. I'm not sure what software you using but Pycharm is an easy way to run Python scripts, you can download it via https://www.jetbrains.com/pycharm/download/#section=mac |
We're working on getting it opened up for support. Can we arrange a webex or the like to do this real time? |
Per Savitha:
Let me know when we can look at this collectively. Due to the nature of the data, we cant keep the access open for long.
So we can set an hour or 30 mins and hatch this out.
Let me know your concerns, if any, else me and Ted are available today after noon at 2 pm or wed between 10 -11 CT.
|
Hi @tedatkc Unfortunately that level is support is not something we can provide on our SDKs. We can confirm that the SDK is working and there's nothing broken in it. I think this is just a matter of setup, we don't have the technical resources to get on a call to live troubleshoot. Doing those steps outlined above should get you on your way. What I can do is is that if you sent me your app.py file so that I can have a look and see if it runs on my machine. To do this you can send it to [email protected]. Please leave your clientid & secret in there otherwise I won't be able run it. |
Problem with connecting. Is this the right way to use code? From the response? Why is connection failing?
Ref: Issue #31.
The text was updated successfully, but these errors were encountered: