getGoogleAuthUrl static method
Generate Google OAuth URL
Implementation
static String getGoogleAuthUrl({required String callbackUrl}) {
final clientId = Auth.config.googleClientId;
if (clientId == null || clientId.isEmpty) {
throw AuthException(
'Google OAuth is not configured. Set GOOGLE_CLIENT_ID.');
}
final state = _generateState(callbackUrl);
final codeVerifier = _generateCodeVerifier();
final codeChallenge = _generateCodeChallenge(codeVerifier);
_storeAuthData(state, codeVerifier, callbackUrl);
final params = {
'client_id': clientId,
'redirect_uri': callbackUrl,
'response_type': 'code',
'scope': 'email profile openid',
'access_type': 'offline',
'prompt': 'consent',
'state': state,
'code_challenge': codeChallenge,
'code_challenge_method': 'S256',
};
return _buildUrl('https://accounts.google.com/o/oauth2/v2/auth', params);
}