Created
July 26, 2022 03:22
-
-
Save aimtiaz11/074fcb65d89bcd1ca42eba5f9bf01017 to your computer and use it in GitHub Desktop.
Get OAuth Token from Anypoint via Connected App (PowerShelll)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ClientId = "<enter connect app client id>" | |
$ClientSecret = "<enter connect app client secret>" | |
## Step 1: Login to get Token | |
$Props = @{ | |
Uri = "https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token" | |
Method = "POST" | |
Headers = @{ | |
'Content-Type' = 'application/json' | |
} | |
Body = @{ | |
'grant_type' = 'client_credentials' | |
'client_id' = $ClientId | |
'client_secret' = $ClientSecret | |
} | ConvertTo-Json | |
} | |
$Response = Invoke-RestMethod @Props | |
$Response | ConvertTo-Json | |
$Token = $Response.access_token | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment