You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+91-1Lines changed: 91 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,11 +114,67 @@ The package provides built-in routes for OAuth authentication:
114
114
1.**Redirect to Bexio**: `/bexio/redirect`
115
115
2.**OAuth Callback**: `/bexio/callback`
116
116
117
-
You can customize the route prefix in your config file:
117
+
You can customize the route prefix and middleware in your config file:
118
118
119
119
```php
120
120
// config/bexio.php
121
121
'route_prefix' => 'custom-bexio-prefix',
122
+
123
+
// Add custom middleware to OAuth routes (in addition to 'web' middleware)
124
+
'route_middleware' => ['auth', 'verified'],
125
+
```
126
+
127
+
#### OAuth Callback Response
128
+
129
+
After the OAuth callback is processed, the user will be redirected to the URL specified in your configuration (`config('bexio.redirect_url')` or `/` by default) with flash session data indicating the result:
130
+
131
+
**Success Response:**
132
+
```php
133
+
// When OAuth authentication is successful
134
+
session()->get('bexio_oauth_success'); // true
135
+
session()->get('bexio_oauth_message'); // 'Successfully authenticated with Bexio.'
136
+
```
137
+
138
+
**Error Responses:**
139
+
```php
140
+
// When user rejects authorization or OAuth returns an error
'redirect_url' => '/dashboard', // Where to redirect after OAuth Callback
401
+
402
+
// Add custom middleware to OAuth routes (in addition to 'web' middleware)
403
+
'route_middleware' => ['auth', 'verified'],
404
+
```
405
+
406
+
#### Route Middleware
407
+
408
+
The OAuth routes (`/bexio/redirect` and `/bexio/callback`) automatically include the `web` middleware group by default. You can add additional middleware using the `route_middleware` configuration:
0 commit comments