File tree Expand file tree Collapse file tree 2 files changed +23
-10
lines changed Expand file tree Collapse file tree 2 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ use DesignMyNight \Laravel \OAuth2 \Http \Controllers \RedirectImplicitGrant ;
4
+
3
5
/**
4
6
* Redirecting endpoint for initiating the OAuth2 Implicit Grant flow.
5
7
* The retrieved access token can be used to call the APIs as protected with the provided middleware.
6
8
*
7
9
* Note: this module does not provide any logic for extracting the access tokens from the url.
8
10
*
9
11
*/
10
- Route::get ('/redirect ' , function (Request $ request ) {
11
- $ query = http_build_query ([
12
- 'client_id ' => config ('authorizationserver.client_id ' ),
13
- 'redirect_uri ' => config ('authorizationserver.redirect_url ' ),
14
- 'response_type ' => 'token ' ,
15
- 'scope ' => 'place-orders ' ,
16
- ]);
17
-
18
- return redirect (config ('authorizationserver.authorization_url ' ) . '? ' . $ query );
19
- });
12
+ Route::get ('/redirect ' , RedirectImplicitGrant::class);
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace DesignMyNight \Laravel \OAuth2 \Http \Controllers ;
4
+
5
+ use Illuminate \Routing \Controller ;
6
+
7
+ class RedirectImplicitGrant extends Controller
8
+ {
9
+ public function __invoke ()
10
+ {
11
+ $ query = http_build_query ([
12
+ 'client_id ' => config ('authorizationserver.client_id ' ),
13
+ 'redirect_uri ' => config ('authorizationserver.redirect_url ' ),
14
+ 'response_type ' => 'token ' ,
15
+ 'scope ' => 'place-orders ' ,
16
+ ]);
17
+
18
+ return redirect (config ('authorizationserver.authorization_url ' ) . '? ' . $ query );
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments