Autodesk Forge accessing b360 hub to get projects - error 404 - autodesk-forge

I'm trying to pubhlish a project using this guide - https://forge.autodesk.com/en/docs/data/v2/tutorials/publish-model/
I am able to get the docs hub ID for the expected hub (using 3 legged token, after having Autodesk provision the b360 docs account, and setting up integration w/ forge app), and pass this into the call to get the projects (using same token, or new token) using this guide - https://forge.autodesk.com/en/docs/data/v2/reference/http/hubs-hub_id-projects-GET/
I get back a response 404 error using the hub ID provided in the GET hubs call that starts with b.xxx from the GET hubs
{
"developerMessage": "The requested resource does not exist.",
"moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": ""
}
I've tried this with a. as well, instead of b. and also no prefix on hub ID with no luck. I verified that this Id matches what is shown in the account admin settings online as well.
The get request looks like this, and includes authorization token in format Bearer {{token}} where {{token}} is the (same) variable for the token that works when getting hub ID's.
https://developer.api.autodesk.com/project/v1/hubs/b.e3a26052-6b48-4a03-9115-xxxxxxxxxxx/projects
Is my format incorrect, or is there something else going on?

The request looks ok, incl. the hub ID (the b. prefix must be there). One thing to check for is whether the actual user you're using to obtain the 3-legged token has access to any projects inside this hub.
Also, what happens when you try the GET hubs/:hub_id endpoint? Can you see the hub information or do you get 404 as well?

Related

Foundry's OAuth2 API Endpoints

I want to test the "Third-party applications" access using Postman.
When trying to obtain an OAuth token I am receiving a '404 Not Found' from Foundry. I suspect that I've configured the wrong URLs for the OAuth2 endpoints.
From reading the documentation
https://<foundryhost.com>/workspace/documentation/product/foundry-backend/security-api#oauth2-api-endpoints
I put together the following 2 endpoints:
Auth URL: https://<foundryhost.com>/api/oauth2/authorize
Access Token URL: https://<foundryhost.com>/api/oauth2/token
Are those correct or am I missing something?
You're on the right track with the service context path - in this case it's multipass - which is Foundry's authentication service.
Try this:
authorize_url=FOUNDRY_STACK + 'multipass/api/oauth2/authorize',
access_token_url=FOUNDRY_STACK + 'multipass/api/oauth2/token'
Looks like the docs could do with some clarification. Will get that fixed.
Another gotcha to remember with OAuth2 on Foundry: the refresh token rotates on use - remember to save both when you request a new access token (this is compliant with the standard, but it is optional).

How to read all data using Revit API?

we are generated client id and secret id. And also we have got access token using Internal Token.
when running the project we can view Revit file which we are uploaded using forge bucket.
Then again are trying to get all elelments (Building,floor,rooms,equipments etc)in Revit model using API.
using this Link:https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET/
we have using API in onDocumentLoadSuccess this event.
we are passing url:https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/metadata
headers :'Authorization': 'Bearer ' + access_token.
In this we are passing urn,access_token parameters also fine.
But we face "Token does not have the privilege for this request" error.(we have already have access token through API.But for the second time we face the error)
How to solve this, please help me on this.
Note that the different endpoints provided by the Forge services require a specific "scope" that the access token must be generated for. For example, according to the GET :urn/metadata docs, this endpoint requires the the access token to be generated with the "data:read" scope.
Also, note that properties of a design processed by the Model Derivative service are actually obtained by a different endpoint - not using GET :urn/metadata, but using GET :urn/metadata/:guid/properties.

How to automatically get refresh token and replace to previous html in autodesk forge

I got stock on how to get token. Pls do you have any tutorial on how to get refresh token? Thanks!I currently know how to show a model in a viewer, however, the token will be expire every 2 hours. It is frustrated for me to search online for how to get token. Pls could u help me on this? Thanks!
These two articles should be of help.
About Refresh Token
Landing your Forge OAuth authentication workflow
When requesting an access_token you'll also get back a refresh token that will enable you to get a new access_token without the user having to log in again.
Depending on which programming language and environment you are using you can also use our SDK's to make your life easier.
E.g. in case of Node.js you can just npm install our forge-api package that will have the necessary functions to request an access_token
The steps are:
1) Redirect the user to the Autodesk log-in page (change both the client_id and redirect_uri to match the values that is used by your registered Forge application):
https://developer.api.autodesk.com/authentication/v1/authorize?response_type=code&client_id=xxx&redirect_uri=xxx&scope=data:read
2) Implement in your application the endpoint that you specified for your Forge application's redirect_uri
3) Using the token you got back above request an access_token
https://developer.api.autodesk.com/authentication/v1/gettoken
4) When you need a new access_token you can use the refresh_token that the gettoken endpoint also returned: https://developer.api.autodesk.com/authentication/v1/refreshtoken

Not able to get token for office365 onenote

I am trying to get access token using WebAuthenticationCoreManager for my native UWP application (Windows 10), am using https://www.onenote.com as the resource.
Before requesting for the token I have associated my app with azure and using client id generating from it.
I have also provided necessary delegated permissions for office365api to my application on azure.
I am getting error with code AADSTS65005 with a message "he request has failed because the client has not specified this resource in its requiredResourceAccess list".
Am I missing some steps that needs to be followed?delegated permission snapshot
The resource URI is https://onenote.com/
Please try with that.

Is there a way to get an existing token for a user using the /tokens resource?

Is it possible to get an existing token for a user using the "/tokens" resource?
Currently, if a token exists, a 409 is returned by the POST:
Request:
POST https://api.box.com/2.0/tokens
Body: {"email":"some-email-a-token-exist-for#email.com"}
Response:
{"type":"error","status":409,"code":"conflict","help_url":"http://developers.box.com/docs/#errors","message":"Token already exists","request_id":"1568559050e4a10f78f66"}
What I'd like to be able to do is make a GET request to retrieve the existing token.
Just so you know, the /tokens endpoint is still in Beta. Even though Box released the rest of the V2 API as GA in December, that endpoint is still being worked on. We're working with a few developers to make sure we get the "instant access" mechanism easily useable, but also secure.
Let us know at api (at) box.com if you'd like to be on our /tokens advisory group.