我正在尝试在 Next.js 上开发一个灵活的身份验证系统,可以使用 Spring (Java) API 后端。使用 Postman 可以完美地实现端点功能。该 API 还提供了自己的 JWT。我想使用 API 端点登录注册用户。这也意味着我需要一种方法来使用服务器中的 JWT 来对尝试登录的用户进行身份验证。
遵循 Next_auth 和 iron-sessions 的文档非常令人困惑。API 工作正常。尤其是 Next_auth 似乎为这种类型的身份验证提供了有限的支持。
我研究了很多帖子、教程,甚至发布了这个问题。这个问题最接近我想要理解的问题,但它涉及登录后状态,并且该过程看起来有点令人困惑。这个问题似乎表明在 Next 上执行自定义身份验证非常复杂,并且最好使用框架。
我是否在这里遗漏了一些东西,或者让 Next js 与外部 API 和 JWT 一起使用是否非常复杂?我不需要 Next 提供的完整堆栈功能。我也不想被迫通过 Google、Twitter、FB 等进行身份验证。
我需要这样的东西,它是使用 React 创建的,并使用 REST API 端点来登录注册用户并管理相应的用户会话。
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("username", enteredEmail);
urlencoded.append("password", enteredPassword);
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow' …
Run Code Online (Sandbox Code Playgroud) 我是 python 编程的新手。遵循 AWS 学习路径:
执行以下块(在 conda_python3 中)时出现错误:
test_data_array = test_data.drop(['y_no', 'y_yes'], axis=1).values #load the data into an array
xgb_predictor.content_type = 'text/csv' # set the data type for an inference
xgb_predictor.serializer = csv_serializer # set the serializer type
predictions = xgb_predictor.predict(test_data_array).decode('utf-8') # predict!
predictions_array = np.fromstring(predictions[1:], sep=',') # and turn the prediction into an
array
print(predictions_array.shape)
Run Code Online (Sandbox Code Playgroud)
AttributeError Traceback (most recent call last) in 1 test_data_array = test_data.drop(['y_no', 'y_yes'], axis=1).values #将数据加载到数组中----> 2 xgb_predictor.content_type = ' text/csv' # 为推理设置数据类型 3 xgb_predictor.serializer …