Unable to get access token with OAuth2 Password Grant

  • 1
  • Question
  • Updated 9 months ago
  • (Edited)
Hey guys,

we want to use the ShareFile API to create folders and share them with users of our company. We want to perform these actions via Python.
So our IT generated a 'Client Id', 'Client Secret' and left the 'Redirect URI' as default.
We had a look at your code samples for Python, but we already have problems to get a token during the first step.

hostname = "COMPANYDOMAIN.sharefile.eu"
username= "USER-NAME-OF-MYSELF"
password= "PASSWORD-OF-MYSELF"
client_id = 'A-LONG-PHRASE-GENERATED-BY-THE-IT'
client_secret = 'ANOTHER-LONG-PHRASE-GENERATED-BY-THE-IT'

The Python function calls an URL with the following parameters like described here:
http://api.sharefile.com/rest/oauth2-password.aspx

grant_type=password&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]

If I execute the function or if I use Postman, I get this message:
"error": "invalid_client", "error_description": "client_id or client_secret is invalid"

However, I am able to use the "Authorization" function in Postman and to get a token.
My theory is, that Postman opens a website, where I have to enter my username and my password. Before I enter my login data, I click the option to use the Employee registration and enter my login data there. So I assume that this process is not covered by the OAuth2 Password Grant, because it tries to enter the login data into the original login mask instead of the Employee mask. Am I right?

So how can we solve this issue?
Photo of Erik Steiner

Erik Steiner

  • 2 Posts
  • 0 Reply Likes
  • frustrated

Posted 9 months ago

  • 1
Photo of Erik Steiner

Erik Steiner

  • 2 Posts
  • 0 Reply Likes
Is anyone able to help?