mimik Developer Documentation

Using the mimik-edge-cli Tool to Get An Access Token

Objective

The objective of this tutorial is to demonstrate how to use the mimik-edge-cli Tool to create and associate an Access Token in a running instance of a node running the edgeEngine Runtime.

Intended Readers

The intended readers of the document are developers that will be using the mimik-edge-cli Tool to perform tasks such as deploying an edgeEngine Image and subsequently an edgeEngine Container.

What You'll Be Doing

In this tutorial, you will be using a Developer ID token which was created previously in the Mimik Developer Console, to execute a command using the mimik-edge-cli to get an Access Token. Then, you will associate that Access Token with the running instance of the edgeEngine Runtime running on the Linux computer.

Technical Prerequisites

A Linux computer with a running instance of edgeEngine Runtime installed and running. For the details about how to install the edgeEngine Runtime on a host computer, read the tutorial, Installing edgeEngine and the mimik-edge-cli Tool on a Linux System or MacOS here.

Getting and Associating an Access Token

Step 1: Copy the Developer ID Token that was created previously in a mimik project in the mimik Developer Console, as shown in the illustration below. Set the Developer ID Token aside for use in the steps to follow.

Developer ID Token
Figure 1: The Developer ID Token is defined in the mimik Developer Console

Step 2: Verify that the edgeEngine Runtime is running on the machine where you intended to get and associate the Access Token. Execute the following command in a terminal window to do the verification:

mimik-edge-cli account get-me

You will get a response similar to the following:

accountId:
linkLocalIp: 192.168.86.31
name: mylab
nodeId: e3424338aaf05bdf25e57385bbf62e12d9f7168b3b3cb9c7ab76795f
supernodeTypeName: _mk-v15-4996e4c2442cc796f2c0ddb4e5e1627d._tcp
version: v2.3.1

If you get an error result, this most probably means that the edgeEngine Runtime is not up and running. In that case, follow the instructions in the tutorial, Installing edgeEngine and the mimik-edge-cli Tool on a Linux System or MacOS to get the edgeEngine Runtime installed and running.

Step 3 : Using the mimik-edge-cli Tool, execute the following command in a terminal window to get a valid Access Token.

mimik-edge-cli account get-edge-access-token -t <DEVELOPER_ID_TOKEN>

WHERE <DEVELOPER_ID_TOKEN> is the token that was defined in the mimik Developer Portal as shown above in Figure 1.

You get a response similar to the following:

access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODE0MzA0ODA1MTkyNjAxNjAwIiwianRpIjoiMHZFNWcxUUpTbXVtUEtkYndDNUtleW5UNlFSSTd2ODIyMTVTN2N5UFQxbiIsImNttttttttttCI6ImJiNmZiYTdkLTYzMjEtNDFjNS1hYzM3LTFhN2E4YTlhNGFjMCIsImF6cCI6ImJiNmZiYTdkLTYzMjEtNDFjNS1hYzM3LTFhN2EccccccccccCIsImlzcyI6Imh0dHBzOi8vbWlkLm1pbWlrMzYwLmNvbS9tSUQvdjEvb2F1dGgvdG9rZW4iLCJub2RlX2lkIjoiNGEwM2NmMDggggggggggMmViMjI2Yjk2MDkxMTBjNjIzNzJjMzJjYTY0ZTExN2ZjMTExOTg4NGUiLCJhdWQiOlsiaHR0cHM6Ly9taW1payIsImh0dHBzOi8vbXN0Lm1pbWlrMzYwLmNvbS9tU1QvdjEvY2xpZW50cy9HZW5lcmljLWVkZ2UiXSwic2NvcGUiOiJvcGVuaWQgZWRnZTptY20gZWRnZTpjbHVzdGVggggggggggmFjY291bnQ6YXNzb2NpYXRlIGVkZ2U6YWNjb3VudDp1bmFzc29jaWF0ZSBlZGdlOnJlYWQ6YWNjb3VudGtleSIsImlhdCI6MTYyODE5OTIzOSwiZXhwIjoxNjQzNzUxMjM5fQ.QBcMbDsZ5resoELfQpN-6WbxArZs15aHiMTWjpnng98

Step 4 : Using the mimik-edge-cli Tool, execute the following command to associate the Access Token on the local machine

mimik-edge-cli account associate -t <ACCESS_TOKEN>

WHERE <ACCESS_TOKEN> is the Access Token that was created above in Step 3.

Upon successful association of the Access Token, you'll get a response similar to the following:

result:
accountId: 2814304805192601600
status: successfully associated

Congratulations! You've just created an Access Token and associated it with an account on the local machine

Review

In this tutorial, you learned:

  • How to confirm that the edgeEngine Runtime is installed on the local machine
  • How to use the mimik-edge-cli Tool to get an Access Token using the Developer ID Token defined in the mimik Developer Portal
  • How to use the mimik-edge-cli Tool to associate the Access Token with a mimik Account
© 2022 mimik Technology Inc. All Rights Reserved