簡體   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