Client Credentials Flow

The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control, or those of another resource owner that have been previously arranged with the authorization server (the method of which is beyond the scope of this specification).

More info https://tools.ietf.org/html/rfc6749#section-4.4

How to Use in PHP

1) Create App in Cidaas

To work with Authorization code flow we need to create Non Interactive Client in cidaas app section

2) Get Access Token

In this example I am going to use cidaas/oauth2-cidaas-php . for more library please visit https://oauth.net/code/

$provider = new Cidaas([
    'baseUrl'                 => 'yourcidaasbaseurl',
    'clientId'                => 'xxxx',    // The client ID assigned to you by the provider
    'clientSecret'            => 'yyyy',   // The client password assigned to you by the provider
]);

$accessToken = $provider->getAccessToken('client_credentials');

print_r($accessToken->getToken());
print_r("\n");

Example:

{
  "access_token": "ey...",
  "userstate": "KNOWN",
  "scope": "scope",
  "expires_in": 86400
}



results matching ""

    No results matching ""