Flutter_Web_AUTH Redirect URI

Viewed 1097

I need some help with redirect URIs. I never used these before. So I have been trying to get Spotify authentication working and redirecting back to my application. I did what most people do I copied the code from this question and got it working with the suggestions from the answers. StackOverflow URI Question

AndriodManifest.xml

<activity android:name="com.linusu.flutter_web_auth.CallbackActivity" >
            <intent-filter android:label="flutter_web_auth">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="partyai"/>
            </intent-filter>
            </activity>

musiccontroller.dart

void loginSpotify() async {
    // Present the dialog to the user
    final result = await FlutterWebAuth.authenticate(
      url:
          "https://accounts.spotify.com/de/authorize?client_id=[client id is here ]\&response_type=token&redirect_uri=partyai://callback&scope=user-read-private%20user-read-email&state=34fFs29kd09",
      callbackUrlScheme: "partyai",
    );
   
// Extract token from resulting url
    final token = Uri.parse(result);
    String at = token.fragment;
    at = "http://website/index.html?$at"; // Just for easy persing
    var accesstoken = Uri.parse(at).queryParameters['access_token'];
    print('token');
    print(accesstoken);
  }

So this code works perfectly fine. However, when I try to modify the "partyai" to "[mycustomname]" the program now doesn't redirect back to flutter nor does it receive the access token. Is there something I need to configure that the original person configured? like a redirect_url auth service? I'm not sure if that makes sense but please feel free to comment with any suggestions. Also here's a list of URIs whitelisted in my Spotify developer account

queursion://callback
partyai://callback
0 Answers
Related