This is a C# class with a public method called ValidUser. The method requires the AppId to be passed to it and will return a True/False on whether the user has purchased your app from the App Store. You can find the AppId for your app after you have started the submission process on the App Store. The user needs to be signed in to their Autodesk account through Inventor because that is where it is getting the User ID. If they are not signed in it will return false.
From what I read, they added this API with Inventor 2016 but then changed how you get the user id in Inventor 2018. So in this method it has a try/catch where it will try using the 2018 method of getting the user id but if it fails it will check using the old method so that it will support users that are not using up to date software.
You will need to add a couple of references to your project:
- C:\Program Files\Autodesk\Inventor
- This is a NuGet package and can be found in the NuGet Package Manager
- I had to make sure I was using .NET Framework 4.5.2 at the time of writing this.
Check out the code on GitHub
I hope this helps.
Autodesk has switched to using Single Sign On in Inventor 2020, which caused this to stop working as it did before. As a workaround the class has been updated to force login before checking the user name. In order to do this, you need to pass the Instance of Inventor to the ValidUser method.