文章目录
1. 微博回调接口
1.1 oauth/urls.py
中添加路由
urlpatterns = [
path('weibo/callback/', views.OauthWeiboCallback.as_view()), # /oauth/weibo/callback/
]
1.2 oauth/views.py
中添加视图函数
http://192.168.56.100:8888/oauth/weibo/callback/
from .models import OauthUser
from rest_framework_jwt.serializers import jwt_payload_handler, jwt_encode_handler
from user.utils import jwt_response_payload_handler
# 通过vue前端传入的code,微博身份验证
class OauthWeiboCallback(APIView):
# 自定义权限类
permission_classes = (AllowAny,