To automate the process of authentication ( which is required before hitting any request on the Lyearn Public API), you will need to setup an environment in Postman. Setting up this environment will eliminate the tedious process of copy pasting an accessToken in the authorization header before hitting a request.

A clientId and clientSecret provided by the Lyearn team would be required to set up this environment

Steps

  1. Go to the Environments tab (visible on the left sidebar on the postman homepage) and create a new environment.

    Screenshot 2022-08-06 at 2.01.31 PM.png


  2. Once a new environment has been created, rename your environment.

    Screenshot 2022-08-06 at 2.03.56 PM.png


  3. Add the clientId and clientSecret provided by the Lyearn Team as environment variables. The names of these variables are case sensitive and should be added in camelCase exactly as mentioned above or shown in the figure below.

    Screenshot 2022-08-06 at 2.04.37 PM.png

    Screenshot 2022-08-06 at 2.05.16 PM.png

  4. Don’t forget to save your environment variables. ctrl + s / cmd + s

  5. Use the environment you just created as the environment for your Lyearn Public API collection.

    Screenshot 2022-08-06 at 3.48.18 PM.png