BrockAllen.OAuth2.OAuth2Client.ProcessCallbackAsync C# (CSharp) Метод

ProcessCallbackAsync() публичный Метод

public ProcessCallbackAsync ( ) : Task
Результат Task
        public async Task<CallbackResult> ProcessCallbackAsync()
        {
            var authCtx = GetContext();
            if (authCtx == null)
            {
                return new CallbackResult
                {
                    Error = "No Authorization Context Cookie"
                };
            }
            var provider = GetProvider(authCtx.ProviderType);
            var ctx = HttpContext.Current;
            var result = await provider.ProcessCallbackAsync(authCtx, ctx.Request.QueryString);
            result.ReturnUrl = authCtx.ReturnUrl;
            result.ProviderName = authCtx.ProviderType.ToString();
            return result;
        }

Usage Example

        public async Task<ActionResult> OAuthTokenCallback()
        {
            var ctx = GetOAuthContextCookie();
            var ip = GetEnabledOAuthIdentityProviders().Single(x => x.ID == ctx.IdP);

            var oauth2 = new OAuth2Client(GetProviderTypeFromOAuthProfileTypes(ip.ProviderType.Value), ip.ClientID, ip.ClientSecret);
            var result = await oauth2.ProcessCallbackAsync();
            if (result.Error != null) return View("Error");

            var claims = result.Claims.ToList();
            claims.Add(new Claim(Constants.Claims.IdentityProvider, ip.Name, ClaimValueTypes.String, Constants.InternalIssuer));
            var id = new ClaimsIdentity(claims, "OAuth");
            var cp = new ClaimsPrincipal(id);

            return ProcessOAuthResponse(cp, ctx);
        }
All Usage Examples Of BrockAllen.OAuth2.OAuth2Client::ProcessCallbackAsync