-
Notifications
You must be signed in to change notification settings - Fork 27
Description
There is no explanation as to why get pat fails.
Uphold username: xxxxxxxxxxx
Uphold password: xxxxxxxxxxx
Label/description for PAT (optional): Test
Creating PAT...
Failed to generate PAT
your Python SDK uphold.py function for creat_pat below doesn't appear to be injecting username and password in there. Your API documentation show un/pw required.
https://uphold.com/en/developer/api/documentation/#personal-access-tokens-pat
def create_pat(self, desc):
"""
Creates a personal access token.
:param String desc A description for the token
:rtype:
A string representing the Personal Access Token
"""
params = {
'description': desc
}
self.headers['Content-Type'] = 'application/json'
data = self._post('/me/tokens', params)
return data.get('accessToken')
API documentation indicates an OTP. However your script doesnt account for that.
Important Notice: This request must be authenticated with your username and password using the HTTP Basic Authentication scheme or via OAuth, and a valid OTP token via the
OTP-Tokenheader.
When attempting to manually request a PAT using curl and assuming OTP is via "Authy" I get the following message
`curl https://api.uphold.com/v0/me/tokens \
> -X POST \
> -H 'OTP-Token: [Authy OTP]' \
> -u hidden-username:hidden-password \
> -d '{ "description": "Test" }'
{"code":"unauthorized","message":"Unauthorized"}`
FURTHER MORE:
API documentation states below
https://uphold.com/en/developer/api/documentation/#basic-authentication
If OTP (One Time Password, also known as Two-Factor Authentication) is required, then you will get an HTTP 401 (Unauthorized) response, along with the HTTP header OTP-Token: Required.
Looking at the response above this is not the case.
So how do I get a PAT via Python ?????