Forum Discussion
Rajendra605
Microsoft
Mar 18, 2024extract appid from decoded jwttoken
I have below ymal . where I am using PowerShell script to extract app from Jw token after decoding it . I am not able to get exact app id ( guid ) from the decoded object. it is coming as ***
...
Rajendra605
Microsoft
Mar 19, 2024
even I am using replacement , I am getting same issue .
$TokenSection.Replace("_", "/").Replace("-", "+");
actually when I am passing hard coded value in $tokensection variable , then I am able to appid in guid format else I am getting ***
LainRobertson
Mar 19, 2024Silver Contributor
The only other diagnostic I can think of is to compare tokens, as the only kind I compared against is an Azure JWT.
You're not using the value from a header, are you, which begins with "Bearer "?
Perhaps purely for the sake of testing, you can fetch a token using the Az.Accounts module, using Get-AzAccessToken, and use the Token property of the returned object to test your existing user-defined function.
Cheers,
Lain