Graphileon 代理功能 - 如何传递凭据
Graphileon Proxy feature - how to pass credentials
我有一个关于 Graphileon 代理功能的问题。我们如何将基本身份验证之类的凭据传递给 Graphileon 代理请求命中后端 API
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"}
})
$.ajax({
url: "/proxy",
method: "POST",
data: body
})
你可以这样做:
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
auth: {
user: '...',
pass: '...',
sendImmediately: false | true
}
})
或
var body = JSON.stringify({
url: "http://<username>:<password>@localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
})
或
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
headers: {
'Authorization': 'Basic ' + btoa('<username>:<password>')
}
}
我有一个关于 Graphileon 代理功能的问题。我们如何将基本身份验证之类的凭据传递给 Graphileon 代理请求命中后端 API
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"}
})
$.ajax({
url: "/proxy",
method: "POST",
data: body
})
你可以这样做:
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
auth: {
user: '...',
pass: '...',
sendImmediately: false | true
}
})
或
var body = JSON.stringify({
url: "http://<username>:<password>@localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
})
或
var body = JSON.stringify({
url: "http://localhost:8080/api",
method: "POST",
body: {key1 : "value1"},
headers: {
'Authorization': 'Basic ' + btoa('<username>:<password>')
}
}