title: Flutter: Oauth2 - Problems with redirect uri
body: <p>I want to set up the oAuth authentication of the Spotify API in my Flutter app. I chose the flutter_web_auth 0.1.1 package. 
  So far, I have managed that the user can log in to Spotify. After logging in, the user should be redirected back to my app. That does not work. Spotify always redirects the user to another website and not back to the app. How do I close the WebView after the user logging in and redirect the user to my app?</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_web_auth/flutter_web_auth.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatefulWidget {
    @override
    _MyAppState createState() =&gt; _MyAppState();
  }
  
  class _MyAppState extends State&lt;MyApp&gt; {
    @override
    void initState() {
      super.initState();
      authenticate();
    }
  
    void authenticate() async {
      // Present the dialog to the user
      final result = await FlutterWebAuth.authenticate(
        url:
            "https://accounts.spotify.com/de/authorize?client_id=78ca499b2577406ba7c364d1682b4a6c&amp;response_type=code&amp;redirect_uri=https://partyai/callback&amp;scope=user-read-private%20user-read-email&amp;state=34fFs29kd09",
        callbackUrlScheme: "https://partyai/callback",
      );
  
  // Extract token from resulting url
      final token = Uri.parse(result).queryParameters['token'];
      print('token');
      print(token);
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('Web Auth example'),
          ),
          body: Center(
            child: Text(
              'test',
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <hr>
  
  <p>android/app/src/main/AndroidManifest.xml</p>
  
  <pre><code>&lt;activity android:name="com.linusu.flutter_web_auth.CallbackActivity" &gt;
              &lt;intent-filter android:label="flutter_web_auth"&gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                  &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
                  &lt;data android:scheme="https://partyai/callback" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/J3a01.png" rel="nofollow noreferrer">enter image description here</a></p>