Base solution for your next web application
Open Closed

Social logins: OAuth Redirect URIs #5072


User avatar
0
affern created

Hello. I'm trying to configure social logins for Facebook and Google. In Facebook I have to fill out an uri for "Valid OAuth Redirect URI" and the same for Google (Authorized redirect URI). Is there any angular component I have to put in this Uri? In Google's field it is an example "http://www.example.com/oauth2callback". Do you have an example uri for aspnetzero? Is it <a class="postlink" href="https://mydomain.com/account/login">https://mydomain.com/account/login</a>?

Now I get this error message: URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.

On this page <a class="postlink" href="https://docs.microsoft.com/en-us/azure/app-service/app-service-mobile-how-to-configure-facebook-authentication">https://docs.microsoft.com/en-us/azure/ ... entication</a> it says: Your redirect URI is the URL of your application appended with the path, /.auth/login/facebook/callback. For example, <a class="postlink" href="https://contoso.azurewebsites.net/.auth/login/facebook/callback">https://contoso.azurewebsites.net/.auth ... k/callback</a>. Make sure that you are using the HTTPS scheme.

But it does not work.

Error in browser:

glyphicons-halflings-regular.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) fontawesome-webfont.af7ae505a9eed503f8b8.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) mysitewebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate:1 POST <a class="postlink" href="https://mysitewebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">https://mysitewebhost.azurewebsites.net ... thenticate</a> 500 (Internal Server Error) abp.js:350 ERROR: abp.js:350 {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null}code: 0details: nullmessage: "An internal error occurred during your request!"validationErrors: null__proto__: Object core.js:1440 ERROR {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null} defaultErrorLogger @ core.js:1440 webpackJsonp.../../../core/esm5/core.js.ErrorHandler.handleError @ core.js:1501 next @ core.js:5491 schedulerFn @ core.js:4319 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:240 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.next @ Subscriber.js:187 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:128 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:92 webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next @ Subject.js:56 webpackJsonp.../../../core/esm5/core.js.EventEmitter.emit @ core.js:4299 (anonymous) @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:365 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run @ zone.js:125 webpackJsonp.../../../core/esm5/core.js.NgZone.runOutsideAngular @ core.js:4681 onHandleError @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:369 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:168 ZoneTask.invoke @ zone.js:460 load (async) invokeAddFunc @ zone.js:1364 scheduleEventListener @ zone.js:1416 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:384 onScheduleTask @ zone.js:274 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:378 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:209 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleEventTask @ zone.js:235 zoneAwareAddListener @ zone.js:1462 addEventListener @ VM2258:3 (anonymous) @ http.js:1638 webpackJsonp.../../../../rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:160 webpackJsonp.../../../../rxjs/esm5/operators/map.js.MapOperator.call @ map.js:57 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../../src/account/login/login.service.ts.LoginService.facebookLoginStatusChangeCallback @ login.service.ts:255 (anonymous) @ login.service.ts:209 a.__wrapper.a.__wrapper @ sdk.js?=1525641212954:108 inform @ sdk.js?=1525641212954:58 a @ sdk.js?=1525641212954:105 (anonymous) @ sdk.js?=1525641212954:105 (anonymous) @ sdk.js?=1525641212954:105 N @ sdk.js?=1525641212954:103 (anonymous) @ sdk.js?=1525641212954:93 (anonymous) @ sdk.js?=1525641212954:54 (anonymous) @ sdk.js?=1525641212954:54 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:398 onInvokeTask @ core.js:4724 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:397 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:165 ZoneTask.invoke @ zone.js:460 postMessage (async) e @ 2VRzCA39w_9.js?version=42:55 send @ 2VRzCA39w_9.js?version=42:55 window.proxyMessage @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 b @ 2VRzCA39w_9.js?version=42:57 k @ 2VRzCA39w_9.js?version=42:57 l @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 require @ 2VRzCA39w_9.js?version=42:36 (anonymous) @ 2VRzCA39w_9.js?version=42:57


23 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you are using ASP.NET Core & Angular version, try to use root website url (<a class="postlink" href="http://localhost:4200">http://localhost:4200</a>).

  • User Avatar
    0
    affern created

    Good morning, @ismcagdas.

    My domain is <a class="postlink" href="https://votecha.com">https://votecha.com</a>. If I put <a class="postlink" href="https://votecha.com/">https://votecha.com/</a> and <a class="postlink" href="https://www.votecha.com/">https://www.votecha.com/</a> in the field for Valid OAuth Redirect URIs, I get this error:

    POST <a class="postlink" href="https://votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">https://votechawebhost.azurewebsites.ne ... thenticate</a> 500 (Internal Server Error) abp.js:350 ERROR: abp.js:350 {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null} core.js:1440 ERROR {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null} defaultErrorLogger @ core.js:1440 webpackJsonp.../../../core/esm5/core.js.ErrorHandler.handleError @ core.js:1501 next @ core.js:5491 schedulerFn @ core.js:4319 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:240 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.next @ Subscriber.js:187 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:128 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:92 webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next @ Subject.js:56 webpackJsonp.../../../core/esm5/core.js.EventEmitter.emit @ core.js:4299 (anonymous) @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:365 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run @ zone.js:125 webpackJsonp.../../../core/esm5/core.js.NgZone.runOutsideAngular @ core.js:4681 onHandleError @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:369 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:168 ZoneTask.invoke @ zone.js:460 load (async) invokeAddFunc @ zone.js:1364 scheduleEventListener @ zone.js:1416 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:384 onScheduleTask @ zone.js:274 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:378 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:209 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleEventTask @ zone.js:235 zoneAwareAddListener @ zone.js:1462 addEventListener @ VM4703:3 (anonymous) @ http.js:1638 webpackJsonp.../../../../rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:160 webpackJsonp.../../../../rxjs/esm5/operators/map.js.MapOperator.call @ map.js:57 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../../src/account/login/login.service.ts.LoginService.facebookLoginStatusChangeCallback @ login.service.ts:273 (anonymous) @ login.service.ts:226 a.__wrapper.a.__wrapper @ sdk.js?=1525682542177:108 inform @ sdk.js?=1525682542177:58 a @ sdk.js?=1525682542177:105 (anonymous) @ sdk.js?=1525682542177:105 (anonymous) @ sdk.js?=1525682542177:105 N @ sdk.js?=1525682542177:103 (anonymous) @ sdk.js?=1525682542177:93 (anonymous) @ sdk.js?=1525682542177:54 (anonymous) @ sdk.js?=1525682542177:54 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:398 onInvokeTask @ core.js:4724 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:397 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:165 ZoneTask.invoke @ zone.js:460 postMessage (async) e @ 2VRzCA39w_9.js?version=42:55 send @ 2VRzCA39w_9.js?version=42:55 window.proxyMessage @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 b @ 2VRzCA39w_9.js?version=42:57 k @ 2VRzCA39w_9.js?version=42:57 l @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 require @ 2VRzCA39w_9.js?version=42:36 (anonymous) @ 2VRzCA39w_9.js?version=42:57

  • User Avatar
    0
    aaron created
    Support Team

    POST https**:**//votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate 500 (Internal Server Error)

    Check the error in Logs.txt.

  • User Avatar
    0
    affern created

    <cite>aaron: </cite>

    POST https**:**//votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate 500 (Internal Server Error)

    Check the error in Logs.txt.

    This is my log:

    ERROR 2018-05-07 09:04:16,429 [4 ] Mvc.ExceptionHandling.AbpExceptionFilter - String reference not set to an instance of a String. Parameter name: s System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s at System.Text.Encoding.GetBytes(String s) at Abp.Extensions.StringExtensions.ToMd5(String str) at GlobalOpinions.Web.Controllers.TokenAuthController.<RegisterExternalUserAsync>d__26.MoveNext() in D:\WordOfOpinions\www\Version2\GlobalOpinions\GlobalOpinions\aspnet-core\src\GlobalOpinions.Web.Core\Controllers\TokenAuthController.cs:line 350 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at GlobalOpinions.Web.Controllers.TokenAuthController.<ExternalAuthenticate>d__24.MoveNext() in D:\WordOfOpinions\www\Version2\GlobalOpinions\GlobalOpinions\aspnet-core\src\GlobalOpinions.Web.Core\Controllers\TokenAuthController.cs:line 282 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.<Execute>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() INFO 2018-05-07 09:04:16,473 [4 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2018-05-07 09:04:16,480 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) in 2548.1516ms INFO 2018-05-07 09:04:16,487 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 2588.3632ms 500 application/json; charset=utf-8 INFO 2018-05-07 09:04:24,381 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">http://votechawebhost.azurewebsites.net ... thenticate</a> 0 INFO 2018-05-07 09:04:24,382 [4 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 09:04:24,383 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 2.304ms 204 INFO 2018-05-07 09:04:24,433 [12 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">http://votechawebhost.azurewebsites.net ... thenticate</a> application/json 332 INFO 2018-05-07 09:04:24,435 [12 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 09:04:24,448 [12 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "ExternalAuthenticate", controller = "TokenAuth", area = ""}. Executing action GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) INFO 2018-05-07 09:04:24,449 [12 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 09:04:24,487 [12 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) with arguments (GlobalOpinions.Web.Models.TokenAuth.ExternalAuthenticateModel) - Validation state: Valid ERROR 2018-05-07 09:04:25,249 [4 ] Mvc.ExceptionHandling.AbpExceptionFilter - String reference not set to an instance of a String. Parameter name: s System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s at System.Text.Encoding.GetBytes(String s) at Abp.Extensions.StringExtensions.ToMd5(String str) at GlobalOpinions.Web.Controllers.TokenAuthController.<RegisterExternalUserAsync>d__26.MoveNext() in D:\WordOfOpinions\www\Version2\GlobalOpinions\GlobalOpinions\aspnet-core\src\GlobalOpinions.Web.Core\Controllers\TokenAuthController.cs:line 350 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at GlobalOpinions.Web.Controllers.TokenAuthController.<ExternalAuthenticate>d__24.MoveNext() in D:\WordOfOpinions\www\Version2\GlobalOpinions\GlobalOpinions\aspnet-core\src\GlobalOpinions.Web.Core\Controllers\TokenAuthController.cs:line 282 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.<Execute>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() INFO 2018-05-07 09:04:25,279 [4 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2018-05-07 09:04:25,280 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) in 830.7446ms INFO 2018-05-07 09:04:25,280 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 846.9981ms 500 application/json; charset=utf-8 INFO 2018-05-07 10:02:51,430 [19 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">http://votechawebhost.azurewebsites.net ... thenticate</a>
    INFO 2018-05-07 10:02:51,432 [19 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 10:02:51,432 [19 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 2.3618ms 204 INFO 2018-05-07 10:03:36,243 [20 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://votechawebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">http://votechawebhost.azurewebsites.net ... thenticate</a> application/json 336 INFO 2018-05-07 10:03:36,246 [20 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 10:03:36,267 [20 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "ExternalAuthenticate", controller = "TokenAuth", area = ""}. Executing action GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) INFO 2018-05-07 10:03:36,268 [20 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-05-07 10:03:36,310 [20 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method GlobalOpinions.Web.Controllers.TokenAuthController.ExternalAuthenticate (GlobalOpinions.Web.Core) with arguments (GlobalOpinions.Web.Models.TokenAuth.ExternalAuthenticateModel) - Validation state: Valid ERROR 2018-05-07 10:03:37,347 [20 ] Mvc.ExceptionHandling.AbpExceptionFilter - String reference not set to an instance of a String. Parameter name: s System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s at System.Text.Encoding.GetBytes(String s) at Abp.Extensions.StringExtensions.ToMd5(String str) at GlobalOpinions.Web.Controllers.TokenAuthController.<RegisterExternalUserAsync>d__26.MoveNext() in D:\WordOfOpinions\www\Version2\GlobalOpinions\GlobalOpinions\aspnet-core\src\GlobalOpinions.Web.Core\Controllers\TokenAuthController.cs:line 350 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at GlobalOpinions.Web.Controllers.TokenAuthController.

  • User Avatar
    0
    aaron created
    Support Team

    externalLoginInfo.EmailAddress is null?

  • User Avatar
    0
    affern created

    I get an error that says that my email is already taken.

  • User Avatar
    0
    aaron created
    Support Team

    Email address must be unique.

  • User Avatar
    0
    affern created

    <cite>aaron: </cite> Email address must be unique.

    Yes, I have registered my user in AspNetZero with my email. And now I try to login with my Facebook profile with the same email address. I can't find an option to create a user with Facebook. Only to login with existing user. And when I try to login with Facebook , I get an error that says that my email is already taken. It seems like the code tries to create an user instead of authenticating.

    If I delete my user in aspnetzero and try to login with Facebook, i get an error: "There is no entity User with id = 85!"

    I have done this:

    • Created an AppId and AppSecret and inserted this in AppSettings.Production
    • Filled in for every field in Basic Settings for Facebook App and inserted my domain address in the field "Valid OAuth Redirect URIs"
    • In Azure I have set App Service Authentication to On and inserted my domain in for Allowded Exernal Redirect Urls, and under Configuration Providers I have set Facebook to "Configured".
    • My code is also updated. At least the Asp.Net Core project and login.component.ts.

    Have I forgotten something?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @affern,

    Yes, I have registered my user in AspNetZero with my email. And now I try to login with my Facebook profile with the same email address.

    This is not supported actually.

    Have you deleted your user on the UI or on the database ?

  • User Avatar
    0
    affern created

    <cite>ismcagdas: </cite> Hi @affern,

    Yes, I have registered my user in AspNetZero with my email. And now I try to login with my Facebook profile with the same email address.

    This is not supported actually.

    Have you deleted your user on the UI or on the database ?

    Hi @ismcagdas :) First I deleted it in UI, then I restored it in db and just changed my email address. After that I got this error: "There is no entity User with id = 85!". My latest userId is 84.

    But if it is not supported then I don't understand how this is suppose to work? Do you think there's a lot of work to get it to work like this? When my user registrate a profile, I also store the the email as username. So if a user later wants to login with facebook, I need to use the email address to identify the user. I also wonder if you not support registering user with Facebook either, because in my solution no buttons are visible for this?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @affern,

    I also wonder if you not support registering user with Facebook either, because in my solution no buttons are visible for this?

    No, registering users via Facebook is supported. The thing not supported is, if a user registers on your website by filling the register form, then user cannot login with facebook.

    User must be registered via Facebook login at the first place in order to login via Facebook.

    Is it possible for you to share your project via email ? We can take a look why social login buttons are not visible in your project.

  • User Avatar
    0
    affern created

    Hi @ismcagdas My social login buttons is visibile on the login-page but not in "Create profile" page. But this is maybe how it should be?

    I can share my project via email, but maybe you can take a look at my page first: <a class="postlink" href="https://votecha.com">https://votecha.com</a> and see if there is something wrong. You can try to register or login with FB if you want. If you try to login with Facebook, I think you will get this error: "There is no entity User with id = 85!". My latest userId is 84, so I think the code tries to create a new user, but something goes wrong.

    I'm going to integrate my solution with Facebook, so my users must be able to authenticate with Facebook. I need some data that is not mandatory in facebook's profile, so the user must be able to register the profile on my page. But then I have to make a solution where the user can associate their user id from Facebook to Aspnetzero's userid. I don't know how to debug Facebook authentication with localhost in my development environment. I also do not understand how to change code of aspnetzero core project to handles the authentication. It looks like this code is not open source. Do you have any advice on how I can solve this?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @affern,

    My social login buttons is visibile on the login-page but not in "Create profile" page. But this is maybe how it should be?

    Yes, exactly, this is true.

    I have tried to login with Facebook on your website but got an error like this on the browser console:

    Application Error: There was an error retrieving the information of the application you wanted to use. The application may be invalid or temporarily unavailable. Please try again later.

    Yes, some parts of social login code is closed but it shouldn't be a problem. It would be great if you can share your project, so we can test with our test Facebook app and see what is wrong in your project.

  • User Avatar
    0
    affern created

    Hi @ismcagdas

    I have now created a test app with my clean aspnetzero code just to verify that my Facebook settings was ok, and the test app worked great.

    So now I have debugged my app in Azure, and I get an error in line 294 in TokenAuthController: loginResult = await _logInManager.LoginAsync(new UserLoginInfo(model.AuthProvider, model.ProviderKey, model.AuthProvider), GetTenancyNameOrNull());

    ErrorMessage:

    Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: GlobalOpinions.Authorization.Users.User, id: 88 at Abp.Domain.Repositories.AbpRepositoryBase2.<GetAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserStore2.<GetUserNameFromDatabaseAsync>d__88.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.<UpdateAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<CreateLoginResultAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsyncInternal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsync>d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at GlobalOpinions.Web.Controllers.TokenAuthController.

    I'm getting back an user in _userRegistrationManager.RegisterAsync in RegisterExternalUserAsync method, and the parameters model.AuthProvider and model.ProviderKey is ok. But the user is not created in db, and I can't understand why :?

    If you do not have any tips on the error messages above, I will send you my project. I really appreciate that you will spend time looking at this :) Have a nice evening!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @affern,

    I have created an issue here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1174">https://github.com/aspnetzero/aspnet-ze ... ssues/1174</a>. Since this is happened in a new template, you don't have to share our project.

  • User Avatar
    0
    affern created

    <cite>ismcagdas: </cite> Hi @affern,

    I have created an issue here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1174">https://github.com/aspnetzero/aspnet-ze ... ssues/1174</a>. Since this is happened in a new template, you don't have to share our project.

    Hi @ismcagdas. No, it is no bug in your template. It is just in my solution. I tested your template without my code, and it works fine. But I have added a lot of fields to the User entity, and maybe that is the reason my solution don't work.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @affern, if that is the case, could you share your project via email ?

  • User Avatar
    0
    affern created

    Hi, @ismcagdas I have now moved all my code to the fresh template and created a test site in Azure and this works great: <a class="postlink" href="https://testvotechafrontwebapp.azurewebsites.net">https://testvotechafrontwebapp.azurewebsites.net</a>. So my code works.

    I used the same code in my prod site with the same database, but I still get the same error. It must be something wrong with my settings in Azure. But I have verified that my App Secret, AppId and Valid OAuth Redirect URIs is correct. If my code works I guess it is no point to send my project to you? But I don't now what can be wrong?

  • User Avatar
    0
    ismcagdas created
    Support Team

    If my code works I guess it is no point to send my project to you?

    You are right.

    Are there any logs on azure ? I'm not talking about the logs written by AspNet Zero. For Facebook, can you leave "Authorized Redirect Uris" empty and try like that ? I think it allows empty values.

  • User Avatar
    0
    affern created

    I installed a clean database, and now it works. Strange :? Is there any settings in db that can affect this?

  • User Avatar
    0
    alper created
    Support Team

    As far as I know, no! Thanks for your feedback ;)

  • User Avatar
    0
    ismcagdas created
    Support Team

    @affern if you need to use the old database, you can use a db data compare tool to find the difference. It might give you a clue.

  • User Avatar
    0
    affern created

    @ismcagdas, thanks. I don't need it now. But maybe I will need this in the future.