I'm using the amplify-authenticator component from the aws-amplify-vue library to enable authentication for my app. I'm trying to figure out how to disable the "Create Account" link on the front end and I can't seem to find anything in the documentation or online. I've seen a few places where users disabled it by hiding it with css and a few places where users were able to disable it with the react library, but I haven't found anything specific for the …
我正在使用 Amplify,并将我的 API 网关代理到 Lambda。我已经启用了 CORS/{proxy+}并部署了 API。在我的 Lambda 函数中,我在我的平凡函数中设置了适当的标头:
import json
def handler(event, context):
print("received event:")
print(event)
return {
"statusCode": 200,
"headers": {
"Access-Control-Allow-Credentials": True,
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Methods": "OPTIONS,POST,GET",
"Access-Control-Allow-Origin": "*",
},
"body": json.dumps(event),
}
Run Code Online (Sandbox Code Playgroud)
此 Lambda 函数位于通过 Cognito 进行身份验证的 API 网关资源之后。
当我使用 Amplify 调用我的 API 时:
let myInit = {
headers: {
Authorization: `Bearer ${(await Auth.currentSession())
.getIdToken()
.getJwtToken()}`
}
};
API.get("adminapi", "/admin", myInit) ...
Run Code Online (Sandbox Code Playgroud)
我的GET请求中缺少可怕的 CORS 标头“Access-Control-Allow-Origin” :
Cross-Origin Request Blocked: The Same Origin Policy …
我很难让 AWS Amplify 与Vite.js 一起工作
// First I was getting this error:
Uncaught ReferenceError: global is not defined
Run Code Online (Sandbox Code Playgroud)
所以,我script在 index.html 的head部分添加了这个
<script>
var global = global || window;
var Buffer = Buffer || [];
var process = process || {
env: { DEBUG: undefined },
version: []
};
</script>
Run Code Online (Sandbox Code Playgroud)
现在,我收到此警告/错误
[Vue warn]: Failed to resolve component: amplify-sign-out
[Vue warn]: Failed to resolve component: amplify-authenticator
Run Code Online (Sandbox Code Playgroud)