What should my redirect URI be in Flutter if the API service I am using doesn't allow the com.example.MYAPPNAME format?

130 views Asked by At

I am trying to build a Flutter app that uses the EventBrite API. They require a redirect URI as well as a client side API Key. I am currently using the FlutterWebAuth package (Package Here) to try and authenticate my app. I have followed the package's directions and my Android Manifest file has the following intent-filter:

<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="com.example.briteapp" />
</intent-filter>

My actual authentication code looks like this:

import 'package:flutter_web_auth/flutter_web_auth.dart';

void authUser() async {
  final result = await FlutterWebAuth.authenticate(
      url:
          "https://www.eventbrite.com/oauth/authorize?response_type=token&client_id=MY_API_KEY&redirect_uri=com.example.briteapp://authcallback",
      callbackUrlScheme: "com.example.briteapp://authcallback");
  final token = Uri.parse(result).queryParameters['token'];

  print(token);
  
}

The EventBrite API requires that you input your redirect URI into their API key settings. However, when I try to input com.example.briteapp://authcallback into the redirect URI field, I get an error that says Redirect must be to a HTTP or HTTPS URL.

enter image description here

I've seen other posts on StackOverflow that work when with the code I was originally using, because the API seems to actually allow those kinds of redirect URLs. I also tried using the same approach as the answer here but no luck. Is there a way that I can still use this API in Flutter?

0

There are 0 answers