I’m getting an “Access blocked: Authorization error, Error: Invalid_scope” error when trying to implement Google Sign-In in my Flutter application with multiple OAuth scopes.
Error Message
Access blocked: Authorization error, Error: Invalid_scope
My Setup
Flutter Version: [Your Flutter version]
google_sign_in package: [Your package version]
Platform: Android
Target: Google Calendar, and basic profile access
OAuth Request Details
My OAuth request includes the following parameters:
login_hint=ak**********@gmail.com
hl=en-IN
response_type=consent_proof
android_options=CAMQAQ
color_scheme=dark
client_id=*200-m552****************n15f59*p7****kr*u.apps.googleusercontent.com
include_granted_scopes=true
scope= openid
flowName=GeneralOAuthFlow
Google Cloud Console Configuration
✅ Created OAuth 2.0 Client ID for Android
✅ Added correct package name and SHA-1 fingerprint
✅ Enabled Google Calendar API
✅ Enabled Google Keep API (if available)
✅ Added test users to OAuth consent screen
Code Implementation
import 'package:google_sign_in/google_sign_in.dart';
class GoogleSignInService {
static final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'profile',
'openid',
'',
'',
],
);
static Future signIn() async {
try {
final GoogleSignInAccount? account = await _googleSignIn.signIn();
return account;
} catch (error) {
print('Google Sign-In Error: $error');
return null;
}
}
}