示例#1
0
        public IActionResult RequestExternalSignIn(string provider, string returnUrl)
        {
            var redirectUrl = Url.Action(nameof(ExternalSignInCallback), new { ReturnUrl = returnUrl });
            AuthenticationProperties authenticationProperties = _accountManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

            return(Challenge(authenticationProperties, provider));
        }
示例#2
0
        public async Task <IActionResult> ExternalLogin(string provider, string returnUrl = null)
        {
            // Request a redirect to the external login provider.
            var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Account", new { returnUrl });
            var properties  = await _accountManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

            return(Challenge(properties, provider));
        }
        public async Task <IActionResult> LinkLogin(string provider)
        {
            // Clear the existing external cookie to ensure a clean login process
            await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);

            // Request a redirect to the external login provider to link a login for the current user
            var redirectUrl = Url.Action(nameof(LinkLoginCallback));

            var properties = await _accountManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, User);

            return(new ChallengeResult(provider, properties));
        }