Skip to content

hook_civicrm_oauthProviders

Summary

This hook generates a list of OAuth providers.

Availability

Hook added in CiviCRM 5.32+ as part of a core-extension (oauth-client).

Definition

hook_civicrm_oauthProviders(&$providers)

Parameters

  • &$providers - an array containing a list of all OAuth providers. See the list of properties in OAuth: Model: Providers. Note that the array-key matches the name.

Returns

  • null

Example

function mymod_civicrm_oauthProviders(&$providers) {
  $providers['demo'] = [
    'name' => 'demo',
    'title' => 'Local Demo',
    'class' => 'Civi\OAuth\CiviGenericProvider',
    'options' => [
      'urlAuthorize' => 'http://oauth2-demo.127.0.0.1.nip.io:8001/lockdin/authorize',
      'urlAccessToken' => 'http://oauth2-demo.127.0.0.1.nip.io:8001/lockdin/token',
      'urlResourceOwnerDetails' => 'http://oauth2-demo.127.0.0.1.nip.io:8001/lockdin/resource',
      'scopes' => ['offline_access']
    ]
  ];
}