Skip to content

Basic auth #51

@salhugues

Description

@salhugues

Hello, I'm looking for an example to add basicauth for my request I haven't found an example on the net for jaguar_ retrofit if somebody can help me.

Here's is my request for my api but I don't know how can I add header and pass basic auth.

class MyApi  extends ApiClient with _$MyApiClient {

  final resty.Route base;
  MyApi(this.base);

  @GetReq(path: "json/works")
  Future<List<MyApiObject>> fetchWorks();

  @GetReq(path: "json/editos")
  Future<List<MyApiObject>> fetchEditos();
}

// My Api Factory
MyApi getMyApi() {

    globalClient = IOClient();
    final repo =
    JsonRepo()
      ..add(MyApiObjectSerializer())
      ..add(UndListSerializer())
      ..add(UndSerializer()); // Don't forget to add all Serializer

    return MyApi(route(StringResources.MY_API_BASE_URL))..jsonConverter = repo;
  }

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions