I want to list all Files for a User, similar to what we have in Autodesk Construction Cloud:
This file is inside a project called Varese but to get all Projects first you need to list all Hubs.
Browsing the API docs I found the Hubs API: https://aps.autodesk.com/en/docs/data/v2/reference/http/hubs-GET/
After retrieving a valid token using your JavaScript library forge-apis, and including the access token in the Bearer
I made two requests:
const userResponse = await axios.get(
"https://api.userprofile.autodesk.com/userinfo",
{
headers: {
Authorization: `Bearer ${credentials.access_token}`,
},
},
);
const hubsResponse = await axios.get(
"https://developer.api.autodesk.com/project/v1/hubs",
{
headers: {
Authorization: `Bearer ${credentials.access_token}`,
},
},
);
Getting 200 from userResponse
proved that the access token works, because I got back my user data:
user {
sub: 'QJ3HRMKNJ8UG',
name: 'AkosK',
given_name: 'Akos',
family_name: 'K',
preferred_username: 'akosk',
email: '[email protected]',
email_verified: true,
profile: 'https://profile.autodesk.com',
picture: 'https://images.profile.autodesk.com/default/user_Y220.png',
locale: 'en-',
updated_at: 1696555555
}
The call to https://developer.api.autodesk.com/project/v1/hubs
also returned 200 but had the following in the response:
{
warnings: [
{
Id: null,
HttpStatusCode: '403',
ErrorCode: 'BIM360DM_ERROR',
Title: 'Unable to get hubs from BIM360DM US.',
Detail: "You don't have permission to access this API",
AboutLink: null,
Source: null,
meta: null
},
{
Id: null,
HttpStatusCode: '403',
ErrorCode: 'BIM360DM_ERROR',
Title: 'Unable to get hubs from BIM360DM EMEA.',
Detail: "You don't have permission to access this API",
AboutLink: null,
Source: null,
meta: null
}
]
}
When I'm authorizing access to my autodesk account these are the permissions that my app is requesting:
In my APS app, all 13 APIs are selected.
What am I missing here?