Authorize endpoint by OAuth2.0 token?

Product: PowerShell Universal
Version: 5.2.1

Hi is it possible to authorize an API endpoint (i.e. a .ps1 script within PSU) by a temporary OAuth2.0 token, i.e. that one that we can get in the Auth0 machine-to-machine application?
Right now the token authorization for the API endpoint is by accepting (which I think is decrypting) a token that is previously generated by PSU and shared with the client; which is more like a pre-shared key…
But what I actually want is kind of like a public key or a short-lived password, that adheres to the OAuth2.0 flow, i.e. my API client use a securely stored Client ID and secret to fetch the temporary token from Auth0 or Okta or whatever, while that token (JWT?) includes a role, and the PSU API endpoint decrypt that temporary token generated by Auth0 to find out if that role is allowed to access; similar to what PostgREST is doing.
Would someone please advise if that is achievable?

This is possible but it is not properly documented. You can use the JWT:DiscoveryDocument value in appsettings.json to load custom JWT settings from an external source.

I’ll open an issue to get this documented.

1 Like

great move, that would solve many problems with my client, thanks!!