Flutter开发圈

flutter Dio Authorization 登录

2018-09-25  本文已影响0人  磊简单
String username = '***';
      String password = '***';
      String basicAuth =
          'Basic ' + base64Encode(utf8.encode('$username:$password'));
      print(basicAuth);
      Dio dio = new Dio();

      dio.post("***"
        "username":"***",
        "password":"***",
        "grant_type":"password"
      },options: new Options(
        headers: {"Authorization":basicAuth},
        contentType: ContentType.parse("application/x-www-form-urlencoded"),
      )).then((response){
        print(response.data);
      });
D14E6682-7A11-4B82-8D38-5B19A61EBC28.png
E51CA3CE.png
上一篇下一篇

猜你喜欢

热点阅读