You are here

function fb_server_auth_url in Drupal for Facebook 7.4

Build a URL where a user can be sent to authorize a facebook app and afterwards get an access_token. Uses facebook's server-side auth mechanism.

2 calls to fb_server_auth_url()
fb_admin_token_generate_process in ./fb.admin.inc
fb_devel_page in ./fb_devel.module
Provides a page with useful debug info.

File

./fb.module, line 951

Code

function fb_server_auth_url($options = array()) {
  if (empty($options['fba'])) {
    $options = fb_get_app();
  }

  // defaults
  $options += array(
    'redirect_uri' => fb_auth_redirect_uri(current_path(), array(
      'query' => array(
        'client_id' => $options['fba'],
      ),
    )),
    'scope' => '',
  );

  // http://developers.facebook.com/docs/authentication/server-side/
  $url = url('https://www.facebook.com/dialog/oauth', array(
    'query' => array(
      'client_id' => $options['fba'],
      'redirect_uri' => $options['redirect_uri'],
      'scope' => $options['scope'],
      'state' => _fb_oauth_state($options['fba']),
    ),
  ));
  return $url;
}