Requesting Access Token via API
AnsweredHi,
My use case here is to automate the extraction of files from an SFTP and store it into one of my Box folders.
I tried to first authenticate myself using "client_id" and "client_secret" with grant_type = client_credentials, however, I get an error - Invalid grant_type parameter or parameter missing
Can someone help me understand what am I doing wrong here?
Below is the code
import requests
url = "https://api.box.com/oauth2/token"
h = {
"Content-Type":"application/x-www-form-urlencoded",
}
params = {
"client_id":"sdfsdfsdfsdfsd",
"client_secret":"sdfsfsdfsdfsdfsdfsdf",
"grant_type":"client_credentials"
}
r = requests.get(url, headers=h, params=params).json()
print(r)
-
Official comment
Hello Yatish,
It looks like you're trying to use client credentials grant, which requires 5 parameters. However, you only have 3 here. Please review our documentation for a sample.
Best,
Kourtney, Box Developer Advocate
Comment actions
Please sign in to leave a comment.
Comments
1 comment