我试图在我的本机应用程序中加入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