【问题标题】:How to use Expo AppAuth module with IdentityServer4如何将 Expo AppAuth 模块与 IdentityServer4 一起使用
【发布时间】:2019-05-18 05:09:07
【问题描述】:

我正在尝试使用 Expo AppAuth 模块在本机反应中使用 IdentityServer4 进行身份验证。似乎无法正确设置 redirectUri。我在重定向到 identityServer 时收到“无效的重定向 uri”错误。

这是我在身份服务器上的客户端

return new List<Client>
            {
                new Client
                {
                    ClientName = "client",
                    ClientId = "client",
                    RequirePkce = true,
                    AllowedGrantTypes = GrantTypes.Code,
                    RequireClientSecret = false,
                    RequireConsent = true,
                    RedirectUris =
                    {
                        "host.exp.Exponent" //Is this correct
                    },
                    AllowOfflineAccess = true,
                    RefreshTokenUsage = TokenUsage.ReUse,
                    AllowedScopes = { "openid", "profile"},

                }
            };

我对 AppAuth 的配置设置是

const config = {
    issuer: 'http://localhost:3000',
    clientId: 'client',
    scopes: ['profile', 'openid'],
    redirectUri: "host.exp.Exponent"
}

【问题讨论】:

    标签: react-native identityserver4 expo appauth


    【解决方案1】:

    您应该指定redirectUri 作为地址值。

    AppAuth 定义:

    async function _executeAsync(props: OAuthProps): Promise<TokenResponse> {
      if (!props.redirectUrl) {
        props.redirectUrl = getDefaultOAuthRedirect();
      }
      assertValidProps(props);
      return await ExpoAppAuth.executeAsync(props);
    }
    
    export function getDefaultOAuthRedirect(): string {
      return `${ExpoAppAuth.OAuthRedirect}:/oauthredirect`;
    }
    

    【讨论】:

    • 我也有这个,但是当重定向回来时我得到这个无法加载 exp://host.exp.exponent
    猜你喜欢
    • 1970-01-01
    • 2022-11-13
    • 2021-12-26
    • 2012-10-18
    • 2018-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-12
    相关资源
    最近更新 更多