知识卡片
对象包装令牌响应
返回带 token 字段的对象,客户端就有稳定的取值名称。以后可补充有效期这类元信息。若最初直接返回字符串,改成对象会改变响应类型,旧客户端需要迁移。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Adding authentication and authorization 7.2 Getting set up for authentication · 查看原书依据
The Token object is a simple object wrapper around a token string. We wrap it in an object so that it’s easier to extend in the future, such as {"token": "abcabcabc"}. For completeness, the schema for this field is described in table
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第07章《Adding authentication and authorization》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch07.htm,阅读块 66)
- 结论依据:章节以 token 字符串置于对象中留出未来扩展位置。
- 原始内容:The Token object is a simple object wrapper around a token string. We wrap it in an object so that it’s easier to extend in the future, such as {"token": "abcabcabc"}. For completeness, the schema for this field is described in table