Open an ExorLive Application using the API

Two overall steps:

  1. From your backend or application server, you call the API to get a URL that is pre-authorized.
  2. You send this URL to you frontend and open it in the users browser. Then The ExorLive application will open in a logged in state.

Details

  1. Get the AdminUserId of the Admin user in the applicable organization/customer. If you have several customers using your link, read about it here: Account Management.
  2. Get an "accesstoken" for this admin user id. Read about it here: API Authentication
  3. Find the "user id" of the user that shall open the ExorLive App.
    • If needed, use the methods in the Users API.
    • Use the Lookup method to find the user id by email address or other details.
    • Use the SetUser method to create a new user if the user does not exist.
    • Use the SetUser method to update the user the necessary role.
  4. Using the "accesstoken in step 2, get the "authkey" of the user id found in step 3. Read about it below.
  5. Given the authKey, create the URL to open using the details described below. Select which ExorLive application to create URL for.
  6. Send the URL to a frontend browser and open it there.
  7. The ExorLive application shall then open in a logged in state. There might be other details on the URL to say how to open the application.

Get authKey

Prerequisites:
  • You have an accesstoken of an administrator user.
  • You know the userId of the user that you want to open ExorLive for.
  • The user must have a login role for the applicable application.
The URL to use is:
[POST] https://auth.exorlive.com/webservices/AuthenticationService.svc/GetAuthKey
Here is some sample code that showcases how to use it:
	public async Task GetAuthKey(int userId, string accessToken)
	{
		// Given the accessToken of an administrator, get the authKey for the given userId in the administrators organization.
		var data = new Dictionary
		{
			{"userId", userId.ToString()}
		};
		var json = MakeJson(data);

		var authKeyUrl = $"{ExorLiveAuthDomain}/webservices/AuthenticationService.svc/GetAuthKey";
		var response = await SendHttpRequest("POST", authKeyUrl, "application/json", json, accessToken);
		var authKeyAsDynamic = JsonConvert.DeserializeObject(response);
		string authKey = authKeyAsDynamic.d;
		return authKey;
	}

Build the URL

There are 3 ExorLive applications that support authKey login.

  • ExorLive Main.
    • BaseUrl: https://exorlive.com/app/
    • culture: en-US / nb-NO / sv-SE / da-DK / fi-FI
    • selectedPersonId: Open Exorlive Main and automatically select the contact with the given user id.
    • AuthUrl: https://auth.exorlive.com/
    • URL template: https://{AuthUrl}/?authKey={authKey}&redirect={URLEncode(appUrl)}
    Note: parameters are case sensitive. Use capital K in authKey.
    
    		public string MakeMainUrl(string culture, string authKey, int contactId)
    		{
    			char separator = '?';
    			string url;
    			string appUrl = "https://exorlive.com/app/";
    			if (!string.IsNullOrWhiteSpace(culture))
    			{
    				appUrl = appUrl + separator + "culture=" + culture;
    				separator = '&';
    			}
    			if (contactId > 0)
    			{
    				appUrl = appUrl + separator + "selectedPersonId=" + contactId;
    				separator = '&';
    			}
    			if (authKey != null)
    			{
    				url = $"https://auth.exorlive.com/?authKey={authKey}";
    				url += "&redirect=" + HttpUtility.UrlEncode(appUrl);
    			}
    			else
    			{
    				url = appUrl;
    			}
    			return url;
    		}
  • ExorLive Go.
    • BaseUrl: https://exorlive.com/m/
    • culture: en-US / nb-NO / sv-SE / da-DK / fi-FI
    • skin: Use a skin code to open the application with a given skin.
    • authKey: parameters are case sensitive. Use capital K in authKey
    • Example: https://exorlive.com/m/?authKey=xxxxxxxxxxxx&culture=en-US&skin=123456
  • ExorLive Assistant.
    • BaseUrl: https://exorlive.com/assistant/
    • culture: en-US / nb-NO / sv-SE / da-DK / fi-FI
    • skin: Use a skin code to open the application with a given skin.
    • authKey: parameters are case sensitive. Use capital K in authKey
    • Example: https://exorlive.com/assistant/?authKey=xxxxxxxxxxxx&culture=en-US&skin=123456
    Advanced Assistant options.
    You may open Assistant with a contact selected, and even a given workout selected.
    • contactId: The exorLive user id (integer) of the contact.
    • workoutId: The exorLive workout id (integer) of a workout assigned to the given contact. Contact Exorlive about the details.
    • Template: https://exorlive.com/assistant/#/assistant/landing/{contactId}/workout/{workoutId}
    • Example: https://exorlive.com/assistant/#/assistant/landing/602589/workout/7135278
    • Example: https://exorlive.com/assistant/?authKey=xxxxxxxxxxxx#/assistant/landing/602589/workout/7135278