I am trying to get the list of users who have access to a project using this Forge API. I have given the scope as account:read
. I tried it suing Postman and also from ASP.NET Core backend which I am developing.
In both cases I get the same error:
{
"status": 403,
"type": "",
"id": "80757c600ab0de6c",
"title": "Forbidden",
"detail": "The 3 legged access token does not have access"
}
Is there anything that I need to change in BIM 360 so that I can resolve this error? This is my backend code (BASE URL):
[HttpPost]
[Route("api/forge/bim360/projectusers")]
public async Task<dynamic> GetProjectUsersAsync([FromQuery] string projectId, [FromQuery] string userId)
{
dynamic access_token = await CheckToken();
RestClient client = new RestClient(BASE_URL);
RestRequest request = new RestRequest("/bim360/admin/v1/projects/{project_id}/users", RestSharp.Method.GET);
request.AddParameter("project_id", projectId, ParameterType.UrlSegment);
request.AddHeader("Authorization", "Bearer " + access_token);
request.AddHeader("User-Id", userId);
try
{
IRestResponse issueTypesResponse = await client.ExecuteGetTaskAsync(request);
dynamic users = JObject.Parse(issueTypesResponse.Content);
return Ok("Found Users");
}
catch (Exception ex)
{
//TODO Add real logger
StreamWriter st = new StreamWriter(@"Logg/logg.txt", true);
st.Write(ex.Message);
st.Close();
return StatusCode(500);
}
}
Any help appreciated.