-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
SDK account
The SDK has functionality to use the UltiMaker Account functionality.
To have a user sign in with their UltiMaker Account, call the account.login
method:
api.account.login()
This will start a secure OAuth2 login flow where the user will give permission to Cura to access their data. After this flow is complete, a signal will be emitted with the updated login state:
def onLoginStateChanged(logged_in: bool = False):
print("logged in", logged_in)
...
api.account.onLoginStateChanged(onLoginStateChanged)
You can also check the isLoggedIn
property at any time:
api.account.isLoggedIn
Now that the user is signed in, you can get some basic information about them to show in your plugin or interface:
api.account.userProfile # dict containing 'user_id', 'username', 'profile_image_url'
If your plugin needs to call one of UltiMaker's Cloud APIs, you can use the access token for this:
api.account.accessToken
Be sure to add this token as Authorization header to your HTTP request as type Bearer. More details about using the UltiMaker Cloud APIs can be found at https://api.ultimaker.com/docs/.
Now that you're all done, you might want to sign the user out:
api.account.logout()
You can also use any of these methods and properties in QML:
import Cura 1.1 as Cura
...
Cura.API.account.login()
- CuraDrivePlugin - Uses the Ultimaker Account and Cloud APIs to backup and restore your Cura configuration.
- Welcome
- Getting Started
- Reporting An Issue
- Core Development
- Plugins & Material Packages
- Printers
- Translations
- Best Practices
- Settings
- 3D Scene
- Profiling
- Cura User Files
- GitHub Actions