reactjs - 与 Auth0 联合在 Amplify React 中不起作用
问题描述
我正在关注这个文档:https://aws-amplify.github.io/docs/js/authentication在 Federated with Auth0 部分,我正在尝试通过我的 Congito React 登录组件设置 Auth0 登录。
但是,一旦登录呈现,我就会收到此错误:
[错误] 42:27.234 AuthError - 错误:未正确配置放大。配置对象缺少必需的身份验证属性。您amplify push
在通过添加身份验证后运行了amplify add auth
吗?有关更多信息,请参阅https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup
我确实运行了放大身份验证然后放大推送,如果我再次运行推送,它说没有要进行的更改
这是我的代码:
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { withAuthenticator } from 'aws-amplify-react';
import { Auth } from 'aws-amplify';
// auth0 configuration, more info in: https://auth0.com/docs/libraries/auth0js/v9#available-parameters
Auth.configure({
auth0: {
domain: <MY DOMAIN>.auth0.com,
clientID: <AUTH0 CLIENT ID>,
redirectUri: 'http://localhost:3000/',
audience: 'https://<MY DOMAIN>.auth0.com/userinfo',
responseType: 'token id_token',
scope: 'openid profile email',
returnTo: 'http://localhost:3000/'
}
});
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default withAuthenticator(App);
有谁知道可能是什么问题?
解决方案
我与 Auth0 社区合作。看起来这似乎与[ERROR] 42:27.234 AuthError - Error: Amplify has not been configured correctly.
错误提示的放大有关。虽然我不知道确切的错误细分,但它确实有助于提供一个可以构建的地方。
我确实发现了这个产生类似错误的开放 github 问题:https ://github.com/aws-amplify/amplify-js/issues/4315
推荐阅读
- python-3.x - 如何从具有不同总和数据组的数据框在条形图顶部添加百分比标签
- javascript - Caesars Cipher,这是一个 freeCodeCamp 编码挑战
- python - 如何根据行和列的值更改 PySpark Dataframe 的大小和分布?
- python - 如何每天在特定列上聚合函数
- c++ - 将IP地址转换为二进制
- c - vs代码调试器(lldb)不显示正确的值
- javascript - 在 div 中居中 svg
- reactjs - 尝试通过更改状态挂钩来更改 React Style 属性
- jquery - 我可以在 Laravel + vue App 中使用 jQuery Ajax 吗?
- javascript - 外部属性为空时是否可以拥有内部属性?