Comments (1)
This isn't configurable at the moment, and probably not in the cards, but...
It is really simple to extend the Google provider and register it yourself :) I would subclass this class:
...with something like this:
class CustomGoogleProvider extends GoogleProvider
{
protected $hd;
// These too if you need them...
// protected $loginHint;
// protected $openIdRealm;
public function __construct($config, HttpClient $httpClient, Input $input)
{
parent::__construct($config, $httpClient, $input);
$this->hd = $config['hd'];
// If you need others...
// $this->loginHint = $config['login_hint'];
// $this->openIdRealm = $config['open_id_realm'];
}
protected function buildAuthorizeQueryString($state)
{
$queryString = parent::buildAuthorizeQueryString($state);
$queryString .= "&hd=".$this->hd;
// Whatever else you need...
$queryString .= "&login_hint=".$this->loginHint;
$queryString .= "&openid.realm=".$this->openIdRealm;
return $queryString;
}
}
...then include whatever else you need in your config:
'google' => [
'id' => 'your-client-id',
'secret' => 'your-client-secret',
'redirect' => 'http://example.com/redirect',
'scope' => [],
'hd' => 'example.com',
'login_hint' => '[email protected]',
'openid.realm' => 'example.com',
],
You'll also need to register the provider, which should be done in a service provider somewhere:
$config = $this->app['config']->get('eloquent-oauth.providers.google');
$customGoogle = new CustomGoogleProvider($config, new HttpClient, $this->app['request']);
$this->app['adamwathan.oauth']->registerProvider('google', $customGoogle);
You'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'.
Hopefully 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.
from eloquent-oauth.
Related Issues (20)
- Not catching ApplicationRejectedException when user reject facebook login HOT 3
- Add provider - Stripe [Request]
- Seems to be incompatible with Laravel 5.1 HOT 1
- Support passing custom data into the `state` param
- Provider Request: Reddit (code provided) HOT 7
- Class 'OAuth' not found HOT 2
- Add documentation for "Designing your users table"
- Rename OAuth facade HOT 2
- Support for twitter? HOT 3
- Request FACEBOOK basic data (gender, user_friends) HOT 1
- Office365 HOT 1
- Adding a 'remember' parameter to login() method HOT 1
- Retrieving The Authenticated User HOT 2
- Merging Accounts HOT 2
- Log in by access token HOT 2
- Using Google Oauth behind proxy
- Authorize more than one provider for one user HOT 1
- Running something on register HOT 1
- ΒΏIs There a way to auth sending email and password to Facebook or google?
- 'No query results for model [App\User].' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eloquent-oauth.