我正在使用 django 和 React 实现一个身份验证系统。这两个应用程序分别在端口 8000、3000 上运行。我使用 Djoser 包实现了身份验证系统。该包使用一些依赖项social_core和social_django。一切似乎都配置正常。我点击登录谷歌按钮...我被重定向到谷歌登录页面,然后返回到端口 3000 处的前端 React 应用程序,并在 url 上显示状态和代码参数。
此时,我将这些参数发布到后端。后端尝试使用以下代码验证状态检查会话存储中是否存在状态密钥(social_core/backends/oauth.py)
def validate_state(self):
"""Validate state value. Raises exception on error, returns state
value if valid."""
if not self.STATE_PARAMETER and not self.REDIRECT_STATE:
return None
state = self.get_session_state()
request_state = self.get_request_state()
if not request_state:
raise AuthMissingParameter(self, 'state')
elif not state:
raise AuthStateMissing(self, 'state')
elif not constant_time_compare(request_state, state):
raise AuthStateForbidden(self)
else:
return state
Run Code Online (Sandbox Code Playgroud)
此时,由于某些原因,状态会话密钥不存在......并且我收到一条错误,指出在会话数据中找不到状态(错误如下)
{"error":["State could not be found in server-side session data."],"status_code":400} …Run Code Online (Sandbox Code Playgroud) django django-socialauth django-rest-framework reactjs djoser
如何在不启动 memcached 的情况下从命令行刷新 Docker 容器 memcached 的所有缓存内容?
以下是c与之相关的示例代码stat.h.bits/stat.h提到的"Never include <bits/stat.h> directly; use <sys/stat.h> instead.".但是struct stat定义于bits/stat.h,并int __xstat (...)在中定义sys/stat.h.代码不会使用任何一个头文件甚至两者编译.如何在#include ...不改变任何一个功能的情况下更改它而进行复制?
#include <stdio.h>
#include <bits/stat.h>
#include <sys/stat.h>
int stat_1(char *filename, struct stat *stat_buf)
{
return __xstat(1, filename, stat_buf); // extern int __xstat (...) defined in sys/stat.h
}
char * test(const char *filename) {
char *result;
stat stat_buf; // struct stat defined in bits/stat.h
printf("DO something here");
if ( stat_1(filename, &sbuf) == -1 …Run Code Online (Sandbox Code Playgroud)