Community
BIM 360 API Forum
Welcome to Autodesk’s BIM 360 API Forums. Share your knowledge, ask questions, and explore popular BIM 360 API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting to the api with the correct scopes. Help!

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
600 Views, 1 Reply

Connecting to the api with the correct scopes. Help!

I am using php to create a little snippet of code to create a bucket on my new app. This is a simple question but how o I add multiple scopes to my request. Here is my code.

 

$headers[] = 'Content-type: application/x-www-form-urlencoded';
$process = curl_init();
curl_setopt($process, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($process, CURLOPT_URL, "https://developer.api.autodesk.com/authentication/v1/gettoken");
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, "client_id=myclientid&client_secret=myclientsecret&grant_type=authorization_code&code=" . strval($code) . "&redirect_uri=http://localhost/siteForge/home.php&scope=code:all");
curl_setopt($process, CURLOPT_POST, 1);

$result = curl_exec($process);
curl_close($process);

 

Also when I try to make the bucket I says I do not have the privileges.

Tags (3)
1 REPLY 1
Message 2 of 2
mikako_harada
in reply to: Anonymous

I'm not php person.  But using a tool like postman, where it shows three variation of php codes like below as an example.

You may want to make use of a tool like that.  you probably have better chance to get help by posting to stackoverflow as this is more about programming language questions.

 

e.g., 

>>>>

curl_setopt_array($curl, array(
CURLOPT_URL => "https://developer.api.autodesk.com/authentication/v1/authenticate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=<>&client_secret=<>&grant_type=client_credentials&scope=data%3Aread%20data%3Acreate%20data%3Awrite%20account%3Awrite%20bucket%3Aread",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
"postman-token: <>"
),
));

<<<<

 

 

 

 


Mikako Harada
Developer Technical Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report