Skip to content
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

get_pat fails - no no sdtout #13

Open
snub-fighter opened this issue Jun 25, 2018 · 1 comment
Open

get_pat fails - no no sdtout #13

snub-fighter opened this issue Jun 25, 2018 · 1 comment

Comments

@snub-fighter
Copy link

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-Token header.

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 ?????

@AlexR1712
Copy link

@byrnereese how I can generate the PAT ?????
Currently I don't know what is the OTP-Method header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants