繁体   English   中英

PayPal OpenId Connect沙盒元数据地址

[英]PayPal OpenId Connect Sandbox Metadata Address

我正在尝试建立一个在沙箱中使用“使用PayPal登录”的峰值。 我正在根据此http://www.cloudidentity.com/blog/2014/07/24/protecting-an-asp-net-webforms-app-with-openid-connect-使用Microsoft.Owin.Security.OpenIdConnect 和azure-ad /缺少更好的例子。

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。

如果我将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是什么?

我通过使用来自以下位置的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;

在某些时候由于请求被中止:无法创建SSL / TLS安全通道沙箱帐户

其次,您在PayPal的“应用程序设置”中配置的Return URL必须是生成的WHOLE回调URL(不仅是域名),而且实际上并没有告诉您任何情况……默认值为

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

暂无
暂无

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

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