public async Task <bool> InvokeReturnPathAsync()
        {
            _logger.WriteVerbose("InvokeReturnPathAsync");

            var model = await AuthenticateAsync();

            var context = new DropboxReturnEndpointContext(Context, model, ErrorDetails)
            {
                SignInAsAuthenticationType = Options.SignInAsAuthenticationType,
                RedirectUri = model.Properties.RedirectUrl
            };

            model.Properties.RedirectUrl = null;

            await Options.Provider.ReturnEndpoint(context);

            if (context.SignInAsAuthenticationType != null && context.Identity != null)
            {
                var signInIdentity = context.Identity;
                if (
                    !string.Equals(signInIdentity.AuthenticationType, context.SignInAsAuthenticationType,
                                   StringComparison.Ordinal))
                {
                    signInIdentity = new ClaimsIdentity(signInIdentity.Claims, context.SignInAsAuthenticationType,
                                                        signInIdentity.NameClaimType, signInIdentity.RoleClaimType);
                }
                Context.Authentication.SignIn(context.Properties, signInIdentity);
            }

            if (context.IsRequestCompleted || context.RedirectUri == null)
            {
                return(context.IsRequestCompleted);
            }
            Response.Redirect(context.RedirectUri);
            context.RequestCompleted();

            return(context.IsRequestCompleted);
        }
 public virtual Task ReturnEndpoint(DropboxReturnEndpointContext context)
 {
     return(OnReturnEndpoint(context));
 }