简体   繁体   English

身份服务器重定向到 React Native 错误

[英]Identity Server redirect to React Native error

I have an Identity Server running.我有一个身份服务器正在运行。

I try to make an authentication from a React Native App.我尝试从 React Native App 进行身份验证。

I am using react-native-app-auth package to do authentication.我正在使用react-native-app-auth package 进行身份验证。

When I do login from the app, I have the Identity Server Login page that is loaded in a browser.当我从应用程序登录时,我在浏览器中加载了身份服务器登录页面。 When I login with the good credential, Identity Server return me an error "The view 'Redirect' was not found..."当我使用良好的凭据登录时,Identity Server 向我返回错误“未找到视图'重定向'...”

Do you know What's missing?你知道缺少什么吗? I expect to be redirected to my app after success login...我希望在成功登录后被重定向到我的应用程序...

Here is my config:这是我的配置:

Identity Server config:身份服务器配置:

public static Client GetMobileClient()
        {
            return new Client
            {
                ClientId = "mobile.code",
                ClientName = "Mobile Client (Code with PKCE)",
                RequireClientSecret = false,
                RedirectUris = { "com.server.acc:/oauthredirect" },
                AllowedGrantTypes = GrantTypes.Code,
                RequirePkce = true,
                AllowedScopes = { "openid", "profile" , "email", "api.read" },
                AllowOfflineAccess = true
            };
        } 

And here is my React Native Config:这是我的 React Native 配置:

Build.gradle Build.gradle

manifestPlaceholders = [ appAuthRedirectScheme: 'com.server.acc' ]

Login.tsx:登录.tsx:

import { authorize, refresh, AuthConfiguration } from 'react-native-app-auth';
...

const config: AuthConfiguration = {
            issuer: 'https://acc.server.com:44344',
            clientId: 'mobile.code',
            redirectUrl: 'com.server.acc:/oauthredirect',
            scopes: ['openid', 'profile', 'email', 'api.read']
        };
          
const authState = await authorize(config);

So once I do "await authorize(config);", we have the login page that is loaded, after putting the good credentials, I have this error:因此,一旦我执行“等待授权(配置);”,我们就会加载登录页面,在放置好凭据后,我会遇到此错误:

在此处输入图像描述

Why is he looking for .cshtml pages???他为什么要寻找.cshtml页面???

Many Thanks !非常感谢 ! I am blocked during 3 days for this !为此我被封锁了3天!

Not sure,but perhaps you should add HTTPS:// infront of the URL here:不确定,但也许你应该在 URL 前面添加HTTPS://

redirectUrl: 'com.server.acc:/oauthredirect',

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM