Я хочу создать реагирующее нативное приложение, интегрирующее keycloack, и получить токен для доступа к API сервера Nodejs, у меня есть пакет для использования: response-native-app-auth, github: https://github.com/FormidableLabs/react-native-app-auth
но все равно не работает, когда я нажимаю кнопку выхода из приложения с ошибкой
код здесь
<!-- language: lang-js -->
import { authorize } from 'react-native-app-auth';
const config = {
issuer: 'http://localhost:8080/auth/realms/testrealms',
clientId: 'passport',
redirectUrl: 'io.identityserver.demo:/callback',
scopes: ['openid', 'profile']
};
export default class App extends Component<Props> {
constructor(props) {
super(props);
this.state = {
hasLoggedInOnce: false,
accessToken: '',
accessTokenExpirationDate: '',
refreshToken: ''
}
}
authorize = async () => {
try {
const authState = await authorize(config);
this.setState(
{
hasLoggedInOnce: true,
accessToken: authState.accessToken,
accessTokenExpirationDate: authState.accessTokenExpirationDate,
refreshToken: authState.refreshToken
},
500
);
} catch (error) {
Alert.alert('Failed to log in', error.message);
}
};
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
React Native Authorize By Keycloak
</Text>
<Text style={styles.instructions}>
{this.state.accessToken}
</Text>
<View>
{
!this.state.accessToken && (
<Button onPress={() => {
this.authorize()
}} title='authorize' />
)
}
</View>
</View>
);
}
}
<!-- end snippet -->