【问题标题】:PayPal OpenId Connect Sandbox Metadata AddressPayPal OpenId Connect 沙盒元数据地址
【发布时间】:2017-10-12 07:37:12
【问题描述】:

我正在尝试构建一个在沙盒中使用通过 PayPal 登录的尖峰。我正在使用基于此http://www.cloudidentity.com/blog/2014/07/24/protecting-an-asp-net-webforms-app-with-openid-connect-and-azure-ad/ 的 Microsoft.Owin.Security.OpenIdConnect 以获取更好的示例。

public void ConfigureAuth(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {

                ClientId = "my test clientid",
                RedirectUri = "http://localhost:50625",
                Scope = "openid profile email address phone",
                Authority = "https://www.sandbox.paypal.com/signin/authorize",
                MetadataAddress = "https://www.paypalobjects.com/.well-known/openid-configuration"

            });

问题是元数据地址。

如果我将 MetadataAddress 设置为 https://www.paypalobjects.com/.well-known/openid-configuration 然后配置是实时的,我发送到的授权 URL 是

https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=etc

这不是沙盒,并且从未听说过我的客户端 ID 并引发错误。如果我然后按后退按钮,请将网址更改为

https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=etc

然后就可以了。

但是如果我将 MetadataAddress 设置为

http://www.sandbox.paypal.com/.well-known/openid-configuration

首先

  1. 我收到错误消息“请求已中止:无法创建 SSL/TLS 安全通道。”
  2. 无论如何,sandbox.paypal.com 上的该文件与实时文件具有相同的配置。

使用 PayPal 沙箱登录的 .well-known/openid-configuration 的正确 URL 是什么?

【问题讨论】:

  • 我刚重启后去了sandbox.paypal.com/.well-known/openid-configuration,但没有登录沙箱,并被重定向到登录页面。所以这可能是错误(1)的原因。即使我可以到达它也无济于事,该文件与另一个文件相同。我想我可以自己主持,但这似乎是精神上的。

标签: c# asp.net paypal owin openid-connect


【解决方案1】:

我通过使用来自

的 Owin.Security.Providers.PayPal 找到了我需要的答案

https://github.com/TerribleDev/OwinOAuthProviders

它似乎没有使用 .well-known/openid-configuration,但其中包含以下端点。

    private const string AuthorizationEndPoint = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
    private const string TokenEndpoint = "https://api.paypal.com/v1/identity/openidconnect/tokenservice";
    private const string UserInfoEndpoint = "https://api.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid";

    private const string SandboxAuthorizationEndPoint = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
    private const string SandboxTokenEndpoint = "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice";
    private const string SandboxUserInfoEndpoint = "https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid";

我最终设法使用我的沙盒帐户登录。

其他尝试相同事情的人的注意事项:

首先需要设置

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

在某个时候因为The request was aborted: Could not create SSL/TLS secure channel sandbox account

其次,您在 PayPal 的应用程序设置中配置的返回 URL 需要是生成的整个回调 URL(而不仅仅是域名),它实际上并没有告诉您它将是什么...默认是

http://localhost[:$port]/signin-paypal

【讨论】:

    猜你喜欢
    • 2017-09-27
    • 2013-06-26
    • 2016-11-17
    • 2011-12-07
    • 2016-05-23
    • 2013-03-06
    • 1970-01-01
    • 2015-11-25
    • 2020-11-29
    相关资源
    最近更新 更多