You are here

private function Settings::accessUrl in Instagram API 8

Generate the Access Url.

Return value

string URL.

File

src/Form/Settings.php, line 174

Class

Settings
Implements the Instagram api Settings form.

Namespace

Drupal\instagram_api\Form

Code

private function accessUrl() {
  $config = $this
    ->config('instagram_api.settings');
  $redirectUrl = Url::fromUri('internal:/instagram_api/callback', [
    'absolute' => TRUE,
  ])
    ->toString();
  $urlBase = $config
    ->get('api_uri') . 'authorize';
  $query = [
    'client_id' => $config
      ->get('client_id'),
    'response_type' => 'code',
    'redirect_uri' => $redirectUrl,
  ];
  $url = Url::fromUri($urlBase, [
    'query' => $query,
    'absolute' => TRUE,
  ])
    ->toString();
  return $url;
}