You are here

public function InstagramOAuth::get_authorize_url in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.lib.php \InstagramOAuth::get_authorize_url()

Returns the properly formatted authorization url.

Parameters

string $redirect_uri. URI to redirect the user to after authorization:

array $scope. Items can be: 'basic', 'comments', 'relationships' and 'likes':

string $response_type. Currently only 'code' is supported:

Return value

string. Propertly formatted authorization url.

File

./drupagram.lib.php, line 500
Classes to implement the full Instagram API

Class

InstagramOAuth
A class to provide OAuth enabled access to the Instagram API

Code

public function get_authorize_url($redirect_uri = NULL, $scope = array(
  'basic',
  'comments',
  'relationships',
  'likes',
), $response_type = 'code') {
  $url = $this
    ->create_url('oauth/authorize', '');
  $url .= '?client_id=' . $this->client_id;
  $url .= '&response_type=' . $response_type;
  if (isset($redirect_uri)) {
    $url .= '&redirect_uri=' . $redirect_uri;
  }
  if (isset($scope)) {
    $url .= '&scope=' . implode('+', $scope);
  }
  return $url;
}