coinbase-advanced-py icon indicating copy to clipboard operation
coinbase-advanced-py copied to clipboard

Authentication error on second page when getting account transactions

Open eprbell opened this issue 1 year ago • 1 comments

Thanks for this project: it's very useful. I'm running into an issue when calling client.get(f"/v2/accounts/{account_id}/transactions").

My code is fairly simple:

    def __get_transactions(self, account_id: str) -> Dict[str, Any]:
        results: List[Dict[str, Any]] = []
        cursor: Optional[str] = None
        current_uri: str = f"/v2/accounts/{account_id}/transactions"
        while True:
            current_page = self.__client.get(current_uri)
            if _DATA in current_page:
                results.extend(current_page[_DATA])
            if _PAGINATION not in current_page or _NEXT_URI not in current_page[_PAGINATION] or not current_page[_PAGINATION][_NEXT_URI]:
                break
            current_uri = current_page[_PAGINATION][_NEXT_URI]
        return results

The first page (the one with URI `f"/v2/accounts/{account_id}/transactions") is retrieved correctly, but the second one (with the next URI) is not and I'm getting:

2024-07-01 19:51:06 - coinbase.RESTClient - ERROR - HTTP Error: 401 Client Error: Unauthorized Unauthorized

The fact that the first page is retrieved correctly suggests that authentication is correct, but I'm not sure why the following pages cause this problem. Any help would be appreciated!

eprbell avatar Jul 02 '24 02:07 eprbell

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 Discord instead (use this invite link if it's your first time accessing the Discord).

github-actions[bot] avatar Jul 02 '24 02:07 github-actions[bot]