Generate JWT Token using PowerShell CMDLETS

Generate JWT Token using PowerShell CMDLETS

With just PowerShell Cmdlets, you can generate a Bearer Auth Token using the following steps.

# please install JWT module in PowerShell
Install-Module JWT

# cmdlet to generate JWT Token
New-Jwt -Header '{"alg": "HS256", "typ": "JWT"}' -PayloadJson '{"iss": "<API_KEY_VALUE>", "exp": <EXPIRY_DATETIME_IN_UNIX_EPOCH>}' -Secret "<API_SECRET_VALUE>"Variables in CMDLET:<API_KEY_VALUE> : API Key Value<API_SECRET_VALUE> : API Secret Value<EXPIRY_DATETIME_IN_UNIX_EPOCH> : Time at which Token Expires in Unix Epochs in GMT (Eg: 1713519027.7295783)


Variables in CMDLET: 

<API_KEY_VALUE> : API Key Value
<API_SECRET_VALUE> : API Secret Value
<EXPIRY_DATETIME_IN_UNIX_EPOCH> : Time at which Token Expires in Unix Epochs in GMT (Eg: 1713519027.7295783)

You can the generated token for Uptycs API calls


    • Related Articles

    • API calling via Swagger

      Go To the "Account Settings". Click the "CREATE" button to generate API keys, which will be downloaded in JSON format. The downloaded JSON will contain information such as customerId, API key, API Secret, Domain, DomainSuffix, and other relevant ...
    • Provisioning roles using API

      Overview Starting with Uptycs portal release 46025, Uptycs provides entity level granular user permissions through roles. This document outlines the process to create roles using API - with examples. Procedure -- Create a new role $ urestapi -k ...
    • Delete assets offline since a particular date using the API

      This script / procedure outlines the process to delete assets which have been offline before a particular date. Prerequisite tools iusql urestapi Procedure Download api key from Uptycs UI Download attached script, delete_offline_assets_since.sh     ...
    • Delete duplicate assets using the API

      Duplicate asset (hostname) on Uptycs platform could be a result of particular asset being in rotation or being used a a loaner laptop in which case, uuid of the asset remains the same and the asset is recorded under different hostnames. Following ...
    • Create Custom Threat Source using API

      The article includes the API query to create and update the threat source. We support uploading CSV as of now. To create Threat source: curl --location --request POST ...