在 react native expo 中设置重定向模式

问题描述

我使用 expo-keycloak 进行身份验证, 应用不会重定向回来。

Keycloak 配置看起来像

  const keycloakConfiguration = {
    clientId: 'CLIENT_ID',realm: 'REALM',url: 'auth.url',// This is usually an url ending with /auth
    scheme : AppConfig.expo.scheme,}

在 App.js 中

  return (
    <KeycloakProvider {...keycloakConfiguration}>
      <Auth />
    </KeycloakProvider>
  );

在 Auth.js 中

  const {
    login,isLoggedIn,token,logout,} = useKeycloak();

  if (!isLoggedIn)
    return (
      <View style={{ margin: 24 }}>
        <Button onPress={login} title={'Login'} />
      </View>
    );

在 App.json 中

{
  "expo":{
    "name": "myapp","slug": "myapp","scheme": "myapp"
  }
}

当我单击“登录”时,Web 浏览器会弹出并显示 keycloak 登录站点,并且工作正常。 在我填写凭据并点击登录后,应用程序不会重定向回来。

我哪里做错了?我尝试在 scheme 中更改 keycloakConfiguration,但没有影响。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)