File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,15 +172,29 @@ public function withGoogle(
172172 $ options ['redirectUri ' ] = _env ('APP_URL ' ) . '/auth/google/callback ' ;
173173 }
174174
175- $ this ->oauthClients [ $ clientName] = new \League \OAuth2 \Client \Provider \Google (array_merge ([
175+ $ this ->withProvider ( $ clientName, new \League \OAuth2 \Client \Provider \Google (array_merge ([
176176 'clientId ' => $ clientId ,
177177 'clientSecret ' => $ clientSecret ,
178178 'redirectUri ' => $ options ['redirectUri ' ],
179- ], $ options ));
179+ ], $ options ))) ;
180180
181181 return $ this ;
182182 }
183183
184+ /**
185+ * Register a generic OAuth client
186+ * ---
187+ * Register a generic OAuth client to use with Leaf Auth, should be a league/oauth2-client compatible client.
188+ * @param string $clientName The name of the client to register
189+ * @param \League\OAuth2\Client\Provider\AbstractProvider $client An instance of a league/oauth2-client compatible client
190+ * @return static
191+ */
192+ public function withProvider (string $ clientName , $ client )
193+ {
194+ $ this ->oauthClients [$ clientName ] = $ client ;
195+ return $ this ;
196+ }
197+
184198 /**
185199 * Return an oauth client
186200 * @param string $clientName The name of the client to return
You can’t perform that action at this time.
0 commit comments