oauth2-azure icon indicating copy to clipboard operation
oauth2-azure copied to clipboard

Client_credentials grant

Open decomplexity opened this issue 3 years ago • 1 comments

Does oauth2-azure support client_credentials grants pls?

decomplexity avatar Mar 06 '23 20:03 decomplexity

Yes, it does, I mean the underlying league/oauth2-client library supports that.

$provider = new TheNetworg\OAuth2\Client\Provider\Azure([
  'tenant' => $tenantId,
  'clientId' => $clientId,
//  'client_secret' => $clientSecret,
  'scope' => 'https://management.azure.com/.default',
]);
$provider->defaultEndPointVersion = $provider::ENDPOINT_VERSION_2_0;

$accessToken = $provider->getAccessToken('client_credentials', ['scope' => $provider->scope, 'client_secret' => $clientSecret]);

mxr576 avatar Oct 28 '24 15:10 mxr576