【发布时间】:2019-07-26 14:38:38
【问题描述】:
我正在制作一个 API 系统,它遵循 localhost:8080/api/v1/end_name 之类的 url,并且我正在使用 django-rest-framework-social-oauth2 库进行社交身份验证,也用于我的自定义用户身份验证。问题是他们正在为像localhost:8080/auth/token这样的url提供api响应,格式如下:
{
"access_token": "........",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write",
"refresh_token": "......"
}
但我需要以我的方式自定义它,因为我的响应格式不同。我的一个就像跟随..
{
"error": false,
"message": "User created successfully",
"data": {
"email": "localtestuse2@beliefit.com"
}
}
我需要data: {} 中的回复。我的一个问题是
- 我该怎么做?
我的另一个问题是
- 我可以将api url
localhost:8080/auth/token自定义为localhost:8080/api/v1/auth/token吗?
【问题讨论】:
标签: django django-rest-framework django-socialauth django-oauth