我正在尝试构建一个在沙箱中使用登录与PayPal的尖峰。由于缺少一个更好的示例,我使用了基于这个Microsoft.Owin.Security.OpenIdConnect的http://www.cloudidentity.com/blog/2014/07/24/protecting-an-asp-net-webforms-app-with-openid-connect-and-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是
这不是沙箱,从来没有听说过我的客户端id &抛出错误。如果然后按后退按钮,请将url更改为
那就成功了。
但是如果我将MetadataAddress设置为
http://www.sandbox.paypal.com/.well-known/openid-configuration
那么,首先
对于使用PayPal沙箱登录的.著名/openid配置,正确的url是什么?
发布于 2017-05-15 15:10:24
通过使用Owin.Security.Providers.PayPal,我找到了我需要的答案
https://github.com/TerribleDev/OwinOAuthProviders
它似乎没有使用众所周知的/openid配置,但其中有以下几个端点。
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中的App中配置的返回URL需要是生成的整个回调URL (而不仅仅是域名),而且它实际上没有告诉您它将是什么.默认情况是
http://localhost[:$port]/signin-paypalhttps://stackoverflow.com/questions/43946946
复制相似问题