react-native - TypeError:无法读取 react-native-app-auth 中未定义的属性“授权”
问题描述
我试图在我的反应原生应用程序中包含 react-native-app-auth,但是每当我使用这些方法(比如授权或撤销)时,我都会收到以下错误
TypeError:无法读取未定义的属性“授权”。
这是我的代码
import { authorize } from 'react-native-app-auth';
accessTokenRequest = async () => {
const config = {
issuer: 'http://localhost:8080',
clientId: 'am.identity.bpss.com',
redirectUrl: 'http://localhost:3000/oauth-redirect',
scopes: ['read','write'],
usePKCE: true,
serviceConfiguration: {
authorizationEndpoint: "http://localhost:8080/oauth/authorize",
tokenEndpoint: "http://localhost:8080/oauth/token",
revocationEndpoint: ""
},
};
// use the client to make the auth request and receive the authState
try {
const result = await authorize(config);
console.log(result);
} catch (error) {
console.log(error);
}
}
当点击登录按钮时,我会调用这个函数。
这是我的 package.json
解决方案
推荐阅读
- c# - 如何从 Microsoft Graph API C# 中的电子邮件地址获取用户 ID
- java - 构建项目时出现 Intellij IDEA StackOverflow 错误
- spring - SpringBoot 表情符号输入
- c# - 使用jmeter命中并发请求时,出现死锁异常?
- javascript - Redux 库源代码中的 observable 是如何工作的?
- ios - Xcode 9.4.1 上传 App Store 时缺少 App Store 图标
- c# - 我可以更改 dot Net C# 窗口标题栏中的“不响应”消息吗?
- docker - 在 tmux 内部,如果没有 sudo,docker 命令将无法工作
- android - AVD 要求我下载系统映像,即使它已经下载
- php - 如何删除 Woo Commerce 产品页面图像锚?