We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
e6f7652
需要携带 token 的,配置文件导出函数。
由于获取 token 的接口与返回值都是不可控的,这部分交给用户自己处理,最终将获得的 token 值塞给 headers 属性即可,tein 内部会处理每个请求都会带上这个 token 的。
module.exports = async function () { const result = await axios({ url: "http://localhost:8081/api/v1/oauth/token", method: "post", data: qs.stringify({ grant_type: "password", username: "dk", password: "admin" }), headers: { Authorization: "Basic c3dhZ2dlcxpzd2FnZ2Vy", "Content-Type": "application/x-www-form-urlencoded" } }); // 拿到 token const { access_token } = result.data; return { apiPrefix: "http://localhost:8081/api/v1", headers: { Authorization: `Bearer ${access_token}` }, apis: [ { req: { url: "/user" }, res: { code: String, message: String, data: { content: [ { name: String, desc: String } ] } } } ] }; };
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: