You are here

public function OauthToken::obtain in Commerce Square Connect 8

Provides a route for square to redirect to when obtaining the oauth token.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request object.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse The response.

1 string reference to 'OauthToken::obtain'
commerce_square.routing.yml in ./commerce_square.routing.yml
commerce_square.routing.yml

File

src/Controller/OauthToken.php, line 25

Class

OauthToken
Provides a controller for Square access token retrieval via OAuth.

Namespace

Drupal\commerce_square\Controller

Code

public function obtain(Request $request) {
  $code = $request->query
    ->get('code');
  $options = [
    'query' => [
      'code' => $code,
    ],
  ];
  return new RedirectResponse(Url::fromRoute('commerce_square.settings', [], $options)
    ->toString());
}