0

Let’s say BIM360 admin has added my BIM360 app from BIM360 App Store to his/her BIM360 account, and gone through the provisioning steps.

After that, when user clicks ‘Open’ link (a sample shown in the screenshot), a page from my app will be opened.

In this page, I need to determine whether this particular BIM360 account already has a corresponding account in my app or not.

To clarify further, my app is a multi-tenant cloud-service, and each tenant/account is tied with a BIM360 account - not with individual BIM360 users. So, regardless of BIM360 user who logged into BIM360 page, I need to redirect him/her to the account corresponding to BIM360 account.

If no corresponding account in my app (which will be the case for first time access), I have to redirect user to 'sign up' page.

Question: how do I find the BIM360 Account ID when user opens my app via 'Open' link in BIM360 page?

One possible workaround (a hack, really) is to use ‘referrer’ in HTTP header (on my page) to grab the URL of BIM360 page, and scrape Account ID out of it.

What is the correct way to do this? Could you point me to a sample code?

Thanks Sample page showing 'open' button

Bandu W
  • 99
  • 8

1 Answers1

0

When the end-user opens your app you should ask to sign in with his/her Autodesk Account, which results in a 3-legged OAuth access token.

With that, your app can call GET Hubs, which returns the list of Hubs that user has access and your app also has access. As this includes all hubs, check for attribute.extension.type == hubs:autodesk.bim360:Account and the hub id will be the BIM 360 Account. You may also check the hub id with b. prefix.

Please note the Hub id has the b. prefix and you need to remove it to get the correct BIM 360 Account ID.

Finally, an end-user that comes to your app may have multiple BIM 360 Docs hubs provisioned to your app, e.g. a contractor that works with multiple projects, so consider that scenario.

Check this article for some other considerations.

EDIT

From comment (23/4/2018):

the workaround you suggested doesn't really solve the problem then. I need a way to figure out the BIM360 Account ID for the page where user clicked 'Open' link.

After the user clicks on "open", your app needs to ask for sign-in, which gives your app a 3-legged token. With that, call GET Hubs endpoint, filter hubs for BIM 360 Docs, if more than one, ask user to select the hub/account, then you have the account ID.

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • Thanks @Augusto. I will try this out. – Bandu W Apr 19 '18 at 13:30
  • Can we operate under the assumption that a single Autodesk user will not have association with more than one BIM360 Accounts? This is important because we do not want to display my app's contents that belongs to B1 BIM360 account while user has clicked 'Open' button from a page of B2 BIM360 account. – Bandu W Apr 20 '18 at 02:29
  • No, a single Autodesk user can have 0, 1, 2 or more BIM 360 Accounts associated. – Augusto Goncalves Apr 20 '18 at 10:20
  • So, the workaround you suggested doesn't really solve the problem then. I need a way to figure out the BIM360 Account ID for the page where user clicked 'Open' link. – Bandu W Apr 23 '18 at 02:09