MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
269 stars 238 forks source link

Redirecting back to google page. #442

Closed abbaty48 closed 11 months ago

abbaty48 commented 11 months ago

Please I need an urgent solution here with redirecting after choosing the account to log in with from the Google consent page, I get redirected back to the Google page instead of my application. I follow this article : https://medium.com/codex/how-to-build-a-google-sign-in-in-flutter-without-firebase-5d0d379b2f64

Using flutter_appauth: ^6.0.1

my android redirects URI is: const GOOGLE_REDIRECT_URI_ANDROID = 'com.veggie:/oauthredirect';

in my build.gradle file, I use:

  defaultConfig {
        applicationId: "com.veggie",
        manifestPlaceholders += ['appAuthRedirectScheme' : 'com.veggie'];
   }
}

my login function

Future<bool> login({bool login = true}) async {
    try {
      var result = await _appAuth.authorizeAndExchangeCode(
          AuthorizationTokenRequest(clientID, redirectUrl,
              issuer: GOOGLE_ISSUER,
              scopes: [
            'email',
            'https://www.googleapis.com/auth/userinfo.profile'
          ]));
      print(result);
      return _handleLogin(result);
    } on PlatformException {
      throw Exception('No internet connection or the request is cancelled.');
    } catch (e) {
      throw Exception('Login has failed while authorizing a login request.');
    }
  }
MaikuB commented 11 months ago

Not something I can help with given redirects etc work with the plugin and a problem like is indicative of misconfiguration. Furthermore, I'm not going to be across every provider and what they require. It's best that you ask the wider community through channels like Slack, Discord etc or you could even ask the author of the article.