美文网首页Flutter开发圈
flutter Dio Authorization 登录

flutter Dio Authorization 登录

作者: 磊简单 | 来源:发表于2018-09-25 15:48 被阅读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);
          });
    
    • postman
    D14E6682-7A11-4B82-8D38-5B19A61EBC28.png
    E51CA3CE.png

    相关文章

      网友评论

        本文标题:flutter Dio Authorization 登录

        本文链接:https://www.haomeiwen.com/subject/zddloftx.html