{"action":"created","issue":{"url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/34","labels_url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/34/comments","events_url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/34/events","html_url":"https://github.com/adamwathan/eloquent-oauth/issues/34","id":58499074,"number":34,"title":"How to send more parameters to google?","user":{"login":"mirago","id":8631224,"avatar_url":"https://avatars.githubusercontent.com/u/8631224?v=3","gravatar_id":"","url":"https://api.github.com/users/mirago","html_url":"https://github.com/mirago","followers_url":"https://api.github.com/users/mirago/followers","following_url":"https://api.github.com/users/mirago/following{/other_user}","gists_url":"https://api.github.com/users/mirago/gists{/gist_id}","starred_url":"https://api.github.com/users/mirago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirago/subscriptions","organizations_url":"https://api.github.com/users/mirago/orgs","repos_url":"https://api.github.com/users/mirago/repos","events_url":"https://api.github.com/users/mirago/events{/privacy}","received_events_url":"https://api.github.com/users/mirago/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-22T11:11:23Z","updated_at":"2015-02-22T17:53:27Z","closed_at":null,"body":"Hi I cannot seem to find a way how to send more parameters to google? E.g I need to send the request to \r\n\r\nhttps://accounts.google.com/o/oauth2/auth?\r\n client_id=424911365001.apps.googleusercontent.com&\r\n response_type=code&\r\n scope=openid%20email&\r\n redirect_uri=https://oa2cb.example.com/&\r\n state=security_token%3D138r5719ru3e1%26url%3Dhttps://oa2cb.example.com/myHome&\r\n login_hint=jsmith@example.com&\r\n openid.realm=example.com&\r\n hd=example.com\r\n\r\nand that hd=example.com is actually what I need. I'm trying to restrict the access to specific domain. Is that currently possible? Thanks \r\n"},"comment":{"url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/comments/75447789","html_url":"https://github.com/adamwathan/eloquent-oauth/issues/34#issuecomment-75447789","issue_url":"https://api.github.com/repos/adamwathan/eloquent-oauth/issues/34","id":75447789,"user":{"login":"adamwathan","id":4323180,"avatar_url":"https://avatars.githubusercontent.com/u/4323180?v=3","gravatar_id":"","url":"https://api.github.com/users/adamwathan","html_url":"https://github.com/adamwathan","followers_url":"https://api.github.com/users/adamwathan/followers","following_url":"https://api.github.com/users/adamwathan/following{/other_user}","gists_url":"https://api.github.com/users/adamwathan/gists{/gist_id}","starred_url":"https://api.github.com/users/adamwathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamwathan/subscriptions","organizations_url":"https://api.github.com/users/adamwathan/orgs","repos_url":"https://api.github.com/users/adamwathan/repos","events_url":"https://api.github.com/users/adamwathan/events{/privacy}","received_events_url":"https://api.github.com/users/adamwathan/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T17:53:27Z","updated_at":"2015-02-22T17:53:27Z","body":"This isn't configurable at the moment, and probably not in the cards, *but...*\r\n\r\nIt is really simple to extend the Google provider and register it yourself :) I would subclass this class:\r\n\r\nhttps://github.com/adamwathan/eloquent-oauth/blob/master/src/AdamWathan/EloquentOAuth/Providers/GoogleProvider.php\r\n\r\n...with something like this:\r\n\r\n```php\r\nclass CustomGoogleProvider extends GoogleProvider\r\n{\r\n    protected $hd;\r\n\r\n    // These too if you need them...\r\n    // protected $loginHint;\r\n    // protected $openIdRealm;\r\n\r\n    public function __construct($config, HttpClient $httpClient, Input $input)\r\n    {\r\n        parent::__construct($config, $httpClient, $input);\r\n        $this->hd = $config['hd'];\r\n\r\n        // If you need others...\r\n        // $this->hd = $config['login_hint'];\r\n        // $this->hd = $config['open_id_realm'];\r\n    }\r\n\r\n    protected function buildAuthorizeQueryString($state)\r\n    {\r\n        $queryString = parent::buildAuthorizeQueryString($state);\r\n        $queryString .= \"&hd=\".$this->hd;\r\n        \r\n        // Whatever else you need...\r\n        $queryString .= \"&login_hint=\".$this->loginHint;\r\n        $queryString .= \"&openid.realm=\".$this->openIdRealm;\r\n\r\n        return $queryString;\r\n    }\r\n}\r\n```\r\n\r\n...then include whatever else you need in your config:\r\n\r\n```php\r\n\t\t'google' => [\r\n\t\t\t'id' => 'your-client-id',\r\n\t\t\t'secret' => 'your-client-secret',\r\n\t\t\t'redirect' => 'http://example.com/redirect',\r\n\t\t\t'scope' => [],\r\n\t\t\t'hd' => 'example.com',\r\n\t\t\t'login_hint' => 'jsmith@example.com',\r\n\t\t\t'openid.realm' => 'example.com',\r\n\t\t],\r\n```\r\n\r\nYou'll also need to register the provider, which should be done in a service provider somewhere:\r\n\r\n```php\r\n                $config = $this->app['config']->get('eloquent-oauth.providers.google');\r\n                $customGoogle = new CustomGoogleProvider($config, new HttpClient, $this->app['request']);\r\n                $this->app['adamwathan.oauth']->registerProvider('google', $customGoogle);\r\n```\r\n\r\nYou'll want to make sure that runs *after* the included service provider if you want it to override the standard Google provider. I haven't looked into it myself to see if there's a way to guarantee that, but if there's not, you can always choose a different alias, like 'custom-google' and use that everywhere you would've used 'google'.\r\n\r\nHopefully that's straightforward enough! The main goal of the package is to normalize authentication with various providers, so I don't want to go down the path of allowing customization that's only applicable to a certain one. Much easier to just register your own provider in that case."}}