I am getting an “Entry blocked: Authorization error, Error: Invalid_scope” error when attempting to implement Google Signal-In in my Flutter software with a number of OAuth scopes.
Error Message
Entry blocked: Authorization error, Error: Invalid_scope
My Setup
Flutter Model: [Your Flutter version]
google_sign_in bundle: [Your package version]
Platform: Android
Goal: Google Calendar, and fundamental profile entry
OAuth Request Particulars
My OAuth request consists of the next parameters:
login_hint=ak**********@gmail.com
hl=en-IN
response_type=consent_proof
android_options=CAMQAQ
color_scheme=darkish
client_id=*200-m552****************n15f59*p7****kr*u.apps.googleusercontent.com
include_granted_scopes=true
scope=https://www.googleapis.com/auth/userinfo.e-mail https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/maintain openid https://www.googleapis.com/auth/userinfo.profile
flowName=GeneralOAuthFlow
Google Cloud Console Configuration
✅ Created OAuth 2.0 Consumer ID for Android
✅ Added right bundle identify and SHA-1 fingerprint
✅ Enabled Google Calendar API
✅ Enabled Google Maintain API (if out there)
✅ Added take a look at customers to OAuth consent display
Code Implementation
import 'bundle:google_sign_in/google_sign_in.dart';
class GoogleSignInService {
static ultimate GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'profile',
'openid',
'https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/keep',
],
);
static Future signIn() async {
attempt {
ultimate GoogleSignInAccount? account = await _googleSignIn.signIn();
return account;
} catch (error) {
print('Google Signal-In Error: $error');
return null;
}
}
}