Skip to content

Instantly share code, notes, and snippets.

@arturo-c
Created January 22, 2014 20:15
Show Gist options
  • Save arturo-c/8566544 to your computer and use it in GitHub Desktop.
Save arturo-c/8566544 to your computer and use it in GitHub Desktop.
oauth config hook
/**
* Implements hook_update_N().
*
* Sets a default oauth configuration.
*/
function apci_defaults_update_6022() {
$authorization_options = array(
'access_token_lifetime' => 0,
'page_title' => 'Authorize All',
'message' => 'Authorize <span id="oauth-auth-appname">@appname</span> to use your account?',
'grant_access_title' => 'Allow',
'signature_methods' =>
array (
0 => 'HMAC-SHA1',
1 => 'HMAC-SHA256',
2 => 'HMAC-SHA384',
3 => 'HMAC-SHA512',
),
'default_authorization_levels' =>
array (
0 => '*',
),
);
$authorization_levels = array (
'*' =>
array (
'name' => '*',
'title' => 'Access content available to your user',
'description' => 'Allow the acting party to access and edit your content.',
'default' => 1,
'delete' => 0,
),
);
db_insert('oauth_common_context')
->fields(array(
'name' => 'default',
'title' => 'Default',
'authorization_options' => serialize($authorization_options),
'authorization_levels' => serialize($authorization_levels)
))
->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment