-
Notifications
You must be signed in to change notification settings - Fork 21
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
Frequent 401 Unauthorized Client Errors #19
Comments
Thank you for reporting! If this is an SDK specific issue, we will look into it and get back to you soon. If this is an API related request, report it in our Advanced API forum instead. |
Hi @camandrewz, thanks for flagging. Has this been resolved? We were able to see you successfully making requests throughout the day. If not you can create a support ticket here and we can help you more directly. |
Hi @urischwartz-cb -I'm getting this issue fairly frequently and sporadically as well. Is there any guidance to resolve this? The responses are unquestionably inconsistent. Meaning, I'll get a working response, make no code changes, run it again and see a failure. Not working:
No code change. Working:
@urischwartz-cb what information can I get you to help you debug? This almost looks like a rate limit of some sort. |
Thank you for flagging! We will prioritize fixing this and get back to you if we need any information to help debug. |
Thanks! Out of curiosity, do you have any thoughts about what could be causing it? I'm wondering if I should move back to the regular rest endpoints for the time being, especially if the investigation may take some time. |
@vinooganesh we just pushed something that will help us identify the source of the unauth issues more clearly. Please retry using the WebSocket client and let me know timestamps of when the error occurred. Thank you! |
@urischwartz-cb sure, here you go: Not working:
Working:
Code: from coinbase.websocket import (WSClient, WSClientConnectionClosedException,
WSClientException)
import time
ws_client = WSClient(key_file="./coinbase-sdk/coinbase_cloud_api_key.json", on_message=on_message, verbose=True)
try:
ws_client.open()
ws_client.ticker(product_ids=["BTC-USD"])
time.sleep(5)
ws_client.ticker_unsubscribe(product_ids=["BTC-USD"])
ws_client.close()
except WSClientConnectionClosedException as e:
print("Connection closed! Retry attempts exhausted.")
except WSClientException as e:
print("Error encountered!") |
@vinooganesh we believe the issue stems from clock skew, since your request JWTs seem to have an expiry time that is greater than 2 minutes past when we receive your request. |
@urischwartz-cb, sure here you go
Updated code:
|
@vinooganesh we just pushed a change that will allow us to confirm the expiry time you are sending us in the failed requests. Please let me know once you are able to repro again and I will check this. |
No problem @urischwartz-cb, here you go (Reproed a few times):
|
@vinooganesh we just pushed a change that should solve the problem for the WSClient. It does seem to have been a clock skew issue. Please let me know if it is resolved. |
@urischwartz-cb - Thanks for all of your help here! It looks good from my end now. |
were fixes committed to this issue? I am experiencing the same problem |
@roosglades We fixed the issue in the WebSocket service. A fix for the REST API is in our release queue. Are you still seeing issues with WebSocket or only REST? |
I was getting them for REST. I updated to 1.1.3 and it seemed to resolved the issue. |
When attempting to use the SDK by calling any of the rest functions ("get_products" for example), sometimes the correct response will be returned, but usually a HTTPError exception occurs with the following: "401 Client Error: Unauthorized Unauthorized". I'm using the proper API keys and the issue seems to be server side with the inconsistent responses.
The text was updated successfully, but these errors were encountered: