Is your feature request related to a problem? Please describe the problem.
For a long time there was an undocumented way to get an access token from the current session using code like [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance...
This is option now removed by #3789 because of assembly isolation
Describe the solution you'd like.
I would like a command that returns a cached or fresh (with -Fresh flag) access token as a secure string, so we can tell people to use that. And have that documented.
Maybe even with a way to specify the scopes, so it can also be used the get tokens for other applications.
$token = Get-MgAccessToken [[-Scope] ......] [-Fresh]
Additional context?
You're able to do:
- Fake request
- Return http response
- Read http request headers
- Extract token
Why not provide a way that just returns set token as a secure string?
Authentication is one of the most difficult things to grasp, being able to provide a way for users to just get an access token without tricks seems like a nice addition.
Is your feature request related to a problem? Please describe the problem.
For a long time there was an undocumented way to get an access token from the current session using code like
[Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance...This is option now removed by #3789 because of assembly isolation
Describe the solution you'd like.
I would like a command that returns a cached or fresh (with
-Freshflag) access token as a secure string, so we can tell people to use that. And have that documented.Maybe even with a way to specify the scopes, so it can also be used the get tokens for other applications.
Additional context?
You're able to do:
Why not provide a way that just returns set token as a secure string?
Authentication is one of the most difficult things to grasp, being able to provide a way for users to just get an access token without tricks seems like a nice addition.