【发布时间】:2020-02-27 04:52:36
【问题描述】:
他们给我的信息是 API 已经在服务器上 我只能使请求类型为 GET 并且需要不同的参数登录端点需要参数“数据” 带有这些值 {"user": "juan", "userid": "123", "passw": "000"}
我需要知道如何使用我只能发出 GET 请求并需要来自 React Native 的参数的 API 登录() {
fetch (Api/a/login',{
method: "GET",
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization', 'Basic ' + "here should go a token or parameters"
//'Authorization', 'Basic ' + base64.encode(this.state.user+ ":" + this.state.userid+ ":" + this.state.password)
}
body: JSON.stringify({ // I don't know if I need you to wear this "body"
user: this.state.user,
userid: this.state.userid,
password: this.state.password
}),
}).then((response) => response.json())
.then((responseData) =>{
console.log("LoginData:-" + JSON.stringify(responseData));
}).done();
}
【问题讨论】:
标签: api react-native jwt-auth