```dart Error: FormatException: Refresh token endp...
# support-questions-legacy
a
Copy code
dart
Error: FormatException: Refresh token endpoint must start with http or https
Copy code
dart
    SuperTokens.init(apiDomain: "http://localhost:8000");
n
Hi
Can you share the full code including imports
Also make sure you’re using this library: https://pub.dev/packages/supertokens_flutter Pub dev cache still shows the old sdk sometimes when you search for it
a
I'm using supertokens_flutter, this is my full code
Copy code
dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
  AuthWrapper.init();
  API.ping();
  runApp(const App());
}
Copy code
dart
import 'package:supertokens_flutter/supertokens.dart';
Copy code
dart
class AuthWrapper {
  static const String apiDomain = "http://localhost:3000";

  static Future<bool> login(String email, String password) async {
    Uri uri = Uri.parse("$apiDomain/login");

    await http.post(uri, body: {
      "formFields": [
        {"id": "email", "value": email},
        {"id": "password", "value": password}
      ]
    }).then((value) {
      Map<String, dynamic> data;

    });

    return true;
  }

  static Future<Status> signUp(String email, String password) async {
    Uri uri = Uri.parse("$apiDomain/signup");
    Status status = Status(success: true, message: "Ok");

    if (AuthWrapper.checkEmailExists(email)) {
      return Future(
          () => Status(success: false, message: "The email already exists"));
    }

    await http.post(uri, body: {
      "formFields": [
        {"id": "email", "value": email},
        {"id": "password", "value": password}
      ]
    }).then((value) {
      Map<String, dynamic> data;

      try {
        data = jsonDecode(value.body);
      } on FormatException catch (e) {
        status =
            Status(success: false, message: "An internal error has occured");
        return;
      }

      if (data['status'] == 'Ok') {
        status = Status(success: true, message: "Signed up for an account");
      }
    });

    return status;
  }

  static bool checkEmailExists(String email) {
    Uri uri = Uri.parse("$apiDomain/signup?email=$email");
    return false;
  }

  /**
   * Current user id of logged in user
   */
  static Future<String> getUserId() {
    return SuperTokens.getUserId();
  }

  static void signOut() {
    SuperTokens.signOut();
  }

  static void init() {
    print("initializing authentication server");
    SuperTokens.init(apiDomain: "http://localhost:3000");
  }
}
Copy code
dart
import 'package:http/http.dart';
import 'package:supertokens_flutter/http.dart' as http;

class API {
  static String baseUrl = "http://localhost:3000/";

  const API();

  static Future<void> ping() async {
    Response res = await http.get(Uri(path: baseUrl + "/ping"));
    print(res.body);
    print("health check");
  }
}
n
So this code
Copy code
dart
import 'package:supertokens_flutter/supertokens.dart';

void main() {
  SuperTokens.init(apiDomain: "http://localhost:3000");
  runApp(const MyApp());
}
with
Copy code
yaml
supertokens_flutter: ^0.0.1
Works fine for me. Can you clear pub cache and re-install dependencies and check? Also version 0.1.0 of the SDK was released recently, you could try upgrading to that and trying again
Also what version of flutter are you using?
2 Views