我正在尝试构建一个在沙箱中使用登录和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。
如果我将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
首先是
使用PayPal沙箱登录的.well-known / openid-configuration的正确网址是什么?
答案 0 :(得分:0)
我从
使用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的应用设置中配置的返回网址需要是生成的全部回调网址(而不仅仅是域名),并且它实际上并没有告诉您什么是该&# #39;将成为......默认为
http://localhost[:$port]/signin-paypal