Base solution for your next web application

Activities of "kythor"

I'm trying to setup registration through social login, twitter in this case.

I added the correct keys in web.config. had to change the code in Startup.cs like this:

private static TwitterAuthenticationOptions CreateTwitterAuthOptions()
        {
            return new TwitterAuthenticationOptions
            {
                ConsumerKey = ConfigurationManager.AppSettings["ExternalAuth.Twitter.ConsumerKey"],
                ConsumerSecret = ConfigurationManager.AppSettings["ExternalAuth.Twitter.ConsumerSecret"],
                BackchannelCertificateValidator = new Microsoft.Owin.Security.CertificateSubjectKeyIdentifierValidator(new[]
                {
                    "A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
                    "0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
                    "7FD365A7C2DDECBBF03009F34339FA02AF333133", // VeriSign Class 3 Public Primary Certification Authority - G5
                    "39A55D933676616E73A761DFA16A7E59CDE66FAD", // Symantec Class 3 Secure Server CA - G4
                    "‎add53f6680fe66e383cbac3e60922e3b4c412bed", // Symantec Class 3 EV SSL CA - G3
                    "4eb6d578499b1ccf5f581ead56be3d9b6744a5e5", // VeriSign Class 3 Primary CA - G5
                    "5168FF90AF0207753CCCD9656462A212B859723B", // DigiCert SHA2 High Assurance Server C‎A 
                    "B13EC36903F8BF4701D498261A0802EF63642BC3" // DigiCert High Assurance EV Root CA
                })
            };
        }

I can click on the twitter icon, and it correctly redirects from twitter back to the application. But it doesnt fill in the email address automatically and when I click on SUBMIT button I get an error:

[NullReferenceException: Object reference not set to an instance of an object.]
   Abp.Web.Mvc.Controllers.AbpController.OnException(ExceptionContext context) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Controllers\AbpController.cs:339
   Castle.DynamicProxy.AbstractInvocation.Proceed() +110
   Castle.DynamicProxy.AbstractInvocation.Proceed() +447
   System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception) +174
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +1134
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +169
   System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +454
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +41
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +64
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +169
   System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +893
   Castle.Proxies.Invocations.Controller_BeginExecuteCore.InvokeMethodOnTarget() +116
   Castle.DynamicProxy.AbstractInvocation.Proceed() +111
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   Castle.Proxies.AccountControllerProxy.BeginExecuteCore(AsyncCallback callback, Object state) +206
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +170
   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +711
   Castle.Proxies.Invocations.Controller_BeginExecute.InvokeMethodOnTarget() +168
   Castle.DynamicProxy.AbstractInvocation.Proceed() +111
   Castle.DynamicProxy.AbstractInvocation.Proceed() +448
   Castle.Proxies.AccountControllerProxy.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +227
   System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +94
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +65
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +170
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +571
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +921
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

any ideas how to get this right?

After some debugging... this is what I found out:

when trying to register through social login, twitter in this case, it takes me back to the Register View. The problem is that twitter does not return the email address. (any solution for that?)

after filling in the register form with an email address, I continue by pressing Submit.

it tries to validate the model through this:

if (!UserName.Equals(EmailAddress) && emailRegex.IsMatch(UserName))

but when initializing the Register View, the UserName is never set. So this line of code will always throw an error.

When looking further, if I provide the "Default" tenant name in the code, it takes me directly to the "Register" method. and there again, the Username is being set using the EmailAddress

model.UserName = model.EmailAddress

but this is also Null...throwing in error as result.

what to do? I think getting the email address from twitter would be the best solution, no?

thanks for the help. I got it working, I can register automatically with my twitter account.

Next problem is when I try to login with my Twitter account. This line in the code is called in method "ExternalLogin":

var loginResult = await _userManager.LoginAsync(loginInfo.Login, tenancyName);

but it always returns "UnknownExternalLogin", even though the account is registered and active...

I'm wondering why loginInfo.Login is needed here, as it only holds "LoginProvider" and "ProviderKey". The actual UserInfo is in "loginInfo" itself.

How to solve this?

Question

Can you please give me more information how to upgrade my application to this new version? I have allready upgraded to packages using

get-project -all | get-package | ?{ $_.Id -like 'Abp*' } | update-package

but how about the new features like "Chat between users", or "password complexity". What is the best, easiest, fastest way to integrate these, without breaking or overwriting changes I have allready done for my custom solution?

Answer

Updated SignalR and Angular.UI.Grid but getting

TypeError: Cannot read property 'length' of undefined

All Grids on the SPA do not work(no content) and saving settings does not work, "internal server error".

Doing all this with MPA is no problem. What am I missing?

Answer

screenshot attached.

as you can see the users are returned correctly from /api/services/app/user/GetUsers

looking further, the error is thrown under this section:

/*
 AngularJS v1.5.6
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
*/

Answer

these are the errors I get when opening the Host SPA

Answer

At this moment I'm trying to implement all the changes from the latest version, this could maybe solve the issue.

But can you tell me how to upgrade the database with the new tables,... as described in "201606150821191_Added_Chat_And_Friendship_Entities" and the rest?

Answer

Now I'm also getting this when opening the backend app:

The name 'AbpSession' does not exist in the current context

@if (AbpSession.MultiTenancySide == MultiTenancySides.Host || IsFeatureEnabled(AppFeatures.ChatFeature))
Line 76:         {
Line 77:             <div data-ng-include="'~/App/common/views/layout/chatbar.cshtml'" data-ng-controller="common.views.layout.chatbar as vm">


Source File: ...\App\common\views\layout\layout.cshtml    Line: 75
Answer

I understand that it's not as straightforward as I first thougth, and merging all your changes in my project manually is actually a good thing, because I learn the structure of aspnetzero.

However, some problems, still persist, even after copying all changed code or layout files.

Most pressing issue now is why AbpSession is throwing an error? This is part of the Abp dll's, which I allready updated. Any help would be welcome.

Showing 1 to 10 of 129 entries