Coder Social home page Coder Social logo

Comments (2)

tshedor avatar tshedor commented on September 18, 2024

@cleanstartgit thanks for using brick.

You should retrieve the token and then store it on the default headers that will be accessed when making subsequent requests:

import 'package:http/http.dart' as http;

try {
  final authResponse = http.post('/token', headers: myEncryptedCredentials);
  final token = jsonDecode(authReponse.body)['token'];
  MyRepository().remoteProvider.defaultHeaders = { 'Authorization' => 'Token $token', 'Content-Type': 'application/json' }
} catch (e) {

}

from brick.

cleanstartgit avatar cleanstartgit commented on September 18, 2024

@tshedor Thank you for the quick response!

I saw the defaultHeaders field in the docs late last night, but I couldn't figure out how to access/set them. Thank you for the insight.

This is such an amazing app, kudos to you and the team. I will gladly buy you guys pizzas and beer next time I'm out that way!

from brick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.