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: docs/oauth.md
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# OAuth 2.0 Authentication
2
2
3
-
OAuth 2.0 authentication allows users to grant your application access to their personal Google Sheets. This method is ideal for user-facing applications where each user needs to access their own spreadsheets.
3
+
OAuth 2.0 authentication allows users to grant your application access to their personal Google Sheets. This method is
4
+
ideal for user-facing applications where each user needs to access their own spreadsheets.
4
5
5
6
## When to Use OAuth Authentication
6
7
@@ -21,21 +22,21 @@ OAuth 2.0 authentication allows users to grant your application access to their
- Use Laravel's built-in encryption for sensitive fields
306
305
- Never expose tokens in client-side code
307
306
308
307
### 2. Scope Management
308
+
309
309
- Only request necessary scopes
310
310
- Use least-privilege principle
311
311
- Clearly explain to users what access you need
312
312
313
313
### 3. Error Handling
314
+
314
315
- Handle expired tokens gracefully
315
316
- Provide clear re-authentication flows
316
317
- Log authentication errors for monitoring
@@ -320,16 +321,19 @@ class RequireGoogleAuth
320
321
### Common OAuth Errors
321
322
322
323
**"redirect_uri_mismatch"**
324
+
323
325
- Ensure redirect URI in Google Console matches exactly with your application
324
326
- Check for http vs https mismatches
325
327
- Verify trailing slashes match
326
328
327
329
**"invalid_grant" or "unauthorized"**
330
+
328
331
- Token has expired and refresh failed
329
332
- Redirect user to re-authenticate
330
333
- Check if refresh token is available
331
334
332
335
**"access_denied"**
336
+
333
337
- User denied permission
334
338
- Handle gracefully with appropriate messaging
335
339
- Provide option to retry authentication
@@ -356,7 +360,3 @@ Route::get('/test-oauth', function (Request $request) {
356
360
}
357
361
})->middleware('auth');
358
362
```
359
-
360
-
## Example Implementation
361
-
362
-
For a complete working example, see the [Laravel Google Sheets Demo Project](https://github.com/kawax/google-sheets-project/blob/6.x/app/Http/Controllers/LoginController.php).
0 commit comments