Mariana Anemone (BETA)
Mariana Anemone is a JavaScript SDK for embedding your app within the Mariana Tek Admin Application.
Note: This is an advanced feature. Please contact integrations@marianatek.com about pricing and availability.
Getting Started
1. Installation
Mariana Anemone can be installed using npm
.
2. Initialize the SDK
In order to begin using Mariana Anemone, you'll first need to initialize it with some basic configuration information. This method will return an object that should be used for all subsequent interaction with the SDK.
initialize(appId, clientId, baseUrl)
Parameter | Required? | Description |
---|---|---|
appId | yes | The appId configured for your Embedded App. |
clientId | yes | The clientID credential issued for your Embedded App. |
baseUrl | yes | The URL where your Embedded App is hosted. |
Example usage:
3. Create the Embedded Component
Establish a connection with the Admin Application to enable cross-domain communication.
createComponent()
Note: This function should be called only once within your application. Repeated calls will result in errors.
Example usage:
4. Authenticate the User
In order to start making authenticated requests against the Mariana Tek Admin API, you will need to obtain an access token. For standalone apps this is done using an OAuth flow, but for Embedded Apps you can simply use the getToken
method from the SDK which will handle this for you. An active token for your App will be returned if the user has already accessed your application during the current session. If there is not an active token, the user will be redirected to begin the OAuth flow, and will be returned to the initial location once the flow is complete. We highly recommend using this method to obtain and retrieve stored access tokens to avoid common issues that arise when attempting to use third-party cookies in many browsers.
Example usage:
You can find a complete example that puts all of these steps together on GitHub.
Full SDK Reference
Auth
getToken()
Retrieve a bearer token from the Admin Application that your embedded application can use to make authenticated requests for the current user. If this user does not yet have an active token for your application, this function will redirect the user to authenticate them and grant a new token, then return them to the point where they initiated the authentication flow with a usable token.
Example usage:
Admin API
getApiBaseUrl()
Returns the base URL for the API corresponding to the brand where your Embedded App has been accessed. This will be most useful if your application is used by multiple brands so that you can ensure you are using the correct endpoints for the context.
Example usage:
Navigation
goToClass(classId)
Redirect the user to the class roster page.
Parameter | Required? | Description |
---|---|---|
classId | yes | The classId for the roster page where the user should be taken. |
Example usage:
goToProfile(userId)
Redirect the user to a user profile page.
Parameter | Required? | Description |
---|---|---|
userId | yes | The userId for the profile page where the user should be taken. |
Example usage:
redirect(url)
Redirect the Admin Application window to an external URL.
Example usage: