Activities of "Jurjen"

thank you for your response.

I see various classes in the namespace Volo.Abp.Http.Client.IdentityModel but cannot figure out how to 'hook in' to the events 'after succesful login' and 'after logout'

I'm pretty sure ABP must have some mechanism like that, for instance in it's UI to react to a logoff so the menu can change, the header in the top-right of the screen so the current userinfo can be shown (of not, after logoff).

I don't know how to explain more clearly.

I need an event or hook into the :

  • 'after succesfull login'
  • 'after logout'

Hi Mailiming,

I will look into the IAccessTokenProvider. But I think you missed the questions at the bottom of my message.

  • We need some way to know when the user has succesfully logged in

    so we can (re)set the token in our Csla environment

  • We also need to know when the user has logged off

    so we can clear the token in our Csla environment

I've looked, but I suppose that mechanism is burried deep within the ABP framework. Is there any way we can accomplish this ? maybe using some sort of eventhandler? I'm sure your UI is also reacting to these login/logoff events ?

• ABP Framework version: v4.3 rc1 • UI type: Blazor • DB provider: EF Core • Identity Server Separated: no • ABP Commercial application

When running the blazor application locally I can see that calls to the HttpApi.Host have a httpheader Authorization with value ‘bearer ’.

<br> We will be using Csla as our businesslogic/data-layer for our application. Csla uses a ‘dataportal’ to retrieve data from the database, this dataportal call routes through the dataportalcontroller on the WebApi and is visible in swagger (https://localhost:44321/api/Blazor/DataPortal) just like all the other Abp methods like AbpApiDefinition (https://localhost:44321/api/abp/api-definition).

Csla ‘calls’ the DataPortal using its own httpClient, however thát httpclient does not have a defaultHttpHeader ‘Authorize’ we get an not-authorized error when calling the DataPortal method on the WebApi. We have been testing and when we sort of manually add defaultHttpHeader Authorize with the token to the httpClient when calling the DataPortal, it doés work :-)

I’m not sure but can we ‘get’ a ready to go (authorized) httpClient from ABP? I’ve tried using

[Inject] public HttpClient httpClient {get;set;}

But there is no ‘Autorize’ DefaultHttpHeader supplied in the resulting httpClient.

At this time we’d like to ask:

  • How can we hook into something like a ‘login-successful’ event and retrieve information (like the access_token) so we can store that for later use in the httpClient we use when calling the dataportal method on the webAPI?
  • How can we hook in to a ‘logout-successful’ kind of event so we can clear the access_token in our code.

It works now, thank you for your support !

Hi Alper,

Yes I did add our private Nuget address to the nuget.config. But in the appsettings.json there’s this line :

"AbpLicenseCode": "{PUT_YOUR_LICENSE_CODE_HERE}"

If I leave it in the file like that the app won’t start and leaves this message in the log file:

2021-02-26 09:43:29.782 +01:00 [ERR] ABP-LIC-0020 - License code not found! Ensure that your appsettings.json has "AbpLicenseCode" key with your license code. 2021-02-26 09:43:29.782 +01:00 [ERR] ABP-LIC-0008 - License check failed for 'Volo.Abp.Identity.Pro.HttpApi-v4.2.0.0'.

If I put our GUID in the AbpLicenseCode the app won’t start either and leaves a similar message in the log file. So I guess the GUID is not the license key. Where can we find the license key because we can't seem to find it on the page where out secret nuget url is.

Thanks for the download link, going to check it rightaway

Hi @Jurjen,

The downloaded version is old and we will update it asap. I'll write here again when we upload the latest version.

Hi Cotur,

Looking forward to that! Do you have any indication when this new version will be available ?

Jurjen

  • Steps to reproduce the issue:

I have downloaded the easy-crm Sample application. Unzipped, followed the steps as explained on this page: https://docs.abp.io/en/commercial/latest/samples/easy-crm

Then I open the solution and run Volo.EasyCrm.Web, I log in to that application, then from VS-2019 I start the Volo.EasyCrm.Blazor project, The login page appears, I log in, then the screen goes gray and the nice 'C' keeps rotating.... that's where things stop working.

I have searched the docs / samples / support forum couldn't find a solution there.

I'm not sure what going wrong but this is one of the warnings I get.

** Could not find IdentityClientConfiguration for . Either define a configuration for  or set a default configuration.

And then at the end there's this Exception: Unhandled exception rendering component: VTable setup of type Blazorise.Snackbar.SnackbarStack failed

  • ABP Framework version: v4.0.0-rc3 (as in the easy-crm.zip, I've tried upgrading the Volo.Abp packages to 4.2.1 but the fails in vs-2019 every time)
  • UI type: MVC / Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Tiered (MVC)
  • Exception message and stack trace:

The MVC application is working just fine, but the Blazor application is failing.

Can anyone shed some light on this problem ?

Kind regards, Jurjen

--- Debug output ---


info: System.Net.Http.HttpClient.AbpMvcClient.LogicalHandler[101]
      End processing HTTP request after 179.9099ms - 200
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\5.0.3\Microsoft.AspNetCore.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
warn: Volo.Abp.IdentityModel.IdentityModelAuthenticationService[0]
      Could not find IdentityClientConfiguration for . Either define a configuration for  or set a default configuration.
info: System.Net.Http.HttpClient.AbpMvcClient.LogicalHandler[100]
      Start processing HTTP request GET https://localhost:44338/api/abp/application-configuration?api-version=1.0
info: System.Net.Http.HttpClient.AbpMvcClient.ClientHandler[100]
      Sending HTTP request GET https://localhost:44338/api/abp/application-configuration?api-version=1.0
info: System.Net.Http.HttpClient.AbpMvcClient.ClientHandler[101]
      Received HTTP response headers after 50.8899ms - 200

info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      PermissionRequirement: EasyCrm.Countries
: /__w/1/s/src/mono/mono/metadata/loader.c:1964 <disabled>
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: VTable setup of type Blazorise.Snackbar.SnackbarStack failed
System.TypeLoadException: VTable setup of type Blazorise.Snackbar.SnackbarStack failed
   at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Blazorise.ComponentActivator.CreateInstance(Type componentType)
   at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateComponent(Type componentType)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame& frame, Int32 parentComponentId)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: No element is currently associated with component 12
      Error: No element is currently associated with component 12
          at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
          at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
          at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
          at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
          at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
          at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
          at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
          at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
          at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
          at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
Microsoft.JSInterop.JSException: No element is currently associated with component 12
Error: No element is currently associated with component 12
    at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
    at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
    at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
    at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
    at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
    at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
    at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
    at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
    at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
    at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1)
   at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: No element is currently associated with component 18
      Error: No element is currently associated with component 18
          at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
          at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
          at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
          at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
          at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
          at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
          at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
          at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
          at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
          at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
Microsoft.JSInterop.JSException: No element is currently associated with component 18
Error: No element is currently associated with component 18
    at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
    at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
    at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
    at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
    at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
    at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
    at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
    at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
    at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
    at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1)
   at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: No element is currently associated with component 5
      Error: No element is currently associated with component 5
          at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
          at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
          at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
          at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
          at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
          at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
          at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
          at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
          at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
          at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
Microsoft.JSInterop.JSException: No element is currently associated with component 5
Error: No element is currently associated with component 5
    at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
    at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
    at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
    at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
    at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
    at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
    at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
    at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
    at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
    at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId)
   at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1)
   at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: No element is currently associated with component 5
      Error: No element is currently associated with component 5
          at e.updateComponent (https://localhost:44307/_framework/blazor.webassembly.js:1:31696)
          at Object.t.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:12129)
          at Object.window.Blazor._internal.renderBatch (https://localhost:44307/_framework/blazor.webassembly.js:1:61899)
          at Object.w [as invokeJSFromDotNet] (https://localhost:44307/_framework/blazor.webassembly.js:1:64421)
          at _mono_wasm_invoke_js_blazor (https://localhost:44307/_framework/dotnet.5.0.0.js:1:190800)
          at wasm_invoke_iiiiii (<anonymous>:wasm-function[5611]:0xdda7c)
          at ves_pinvoke_method (<anonymous>:wasm-function[5708]:0xdfb5f)
          at interp_exec_method (<anonymous>:wasm-function[2155]:0x44c05)
          at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
          at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
Microsoft.JSInterop.JSException: No element is currently associated with component 5
Showing 11 to 18 of 18 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11