代码之家  ›  专栏  ›  技术社区  ›  Bagzli

如何在NativeScript应用程序上使用授权码设置Identity Server 4?

  •  0
  • Bagzli  · 技术社区  · 7 年前

    我有一个本机脚本应用程序,我希望使用Identity Server 4登录它。现在,我正处于设置Identity Server 4客户端的阶段,我不能100%确定我所拥有的是正确的还是遗漏了什么。我在网上找到的所有例子在谈到本机应用程序时都有很大的缺点,除了他们都说这是可能的之外。

    以下是我当前对客户端的实现:

    new Client
    {
        ClientId = "nativeapp",
        ClientName = "Native App Sample",
        ClientSecrets = new List<Secret> { new Secret { Value = "secret".Sha256() }},
        Enabled = true,
        AllowedGrantTypes = GrantTypes.Code,
        RedirectUris = { "http://localhost:5003/home" },
        PostLogoutRedirectUris = { "http://localhost:5003/home" },
        AllowedCorsOrigins = { "http://localhost:5003" },
        AllowedScopes =
        {
            IdentityServerConstants.StandardScopes.OpenId,
            IdentityServerConstants.StandardScopes.Profile,
            "Panibus"
        },
        RequirePkce = true,
        AccessTokenType = AccessTokenType.Jwt
    }
    

    我是否需要提供重定向URI?我是否需要客户机机密,因为我看不到其中任何一个正在使用,但可能我不了解PKCE流的某些内容以及所使用的那些内容?
    目前,它可以很好地处理隐式流和角度流,现在我尝试转到本机脚本和授权代码流。

    0 回复  |  直到 7 年前