How to set redirect_uri parameter on OpenIdConnectOptions for ASP.NET Core

后端 未结 2 946
说谎
说谎 2020-12-14 10:34

I\'m trying to connect an ASP.NET application to Salesforce using OpenId, Currently this is my connecting code so far. I think I got everything except the redirect_uri param

相关标签:
2条回答
  • 2020-12-14 11:17

    You need to set an event listen for the OnRedirectToIdentityProvider

    in your case:

    x.Events.OnRedirectToIdentityProvider = async n =>
    {
        n.ProtocolMessage.RedirectUri = <Redirect URI string>;
        await Task.FromResult(0);
    }
    
    0 讨论(0)
  • 2020-12-14 11:25

    redirect_uri is automatically computed for you using the scheme, host, port and path extracted from the current request and the CallbackPath you specify.

    x.RedirectUri = "https://login.salesforce.com/services/oauth2/success" looks highly suspicious (unless you work for Salesforce): don't forget it's the callback URL the user agent will be redirected to when the authentication flow completes, not the authorization endpoint of your identity provider.

    So in your case, the user will be redirected to http(s)://yourdomain.com/services/oauth2/success. Is it the address you registered in your Salesforce options?

    0 讨论(0)
提交回复
热议问题