aspnetcore-angular-universal icon indicating copy to clipboard operation
aspnetcore-angular-universal copied to clipboard

Adding ADAL and guards causes a Window is not defined error

Open albrookesplowman opened this issue 7 years ago • 2 comments

I am trying to added ADAL authentication (using the npm package adal-angular4) and the instructions in the following blog:

http://www.digital-moves.eu/2018/07/19/authentication-with-azure-ad-angular-6-client-web-api/

into this solution but when I add the guard I get the Windows is not defined error. I am have attached a screenshot. I am not sure whether it is something to do with the server side rendering.

TestApp.zip untitled

albrookesplowman avatar Nov 06 '18 11:11 albrookesplowman

you're trying to access the window property on the server. this is one of the 'Gotchas' of using server side rendering. take a look at the README

curlyfro avatar Nov 06 '18 12:11 curlyfro

hi @curlyfro , thanks for the update... I read that bit and then got a bit confused... sorry :) Does this type of constructor addition go into the Authentication Guard, the app component, or in the service class that I have created around the adal-angular4 package? I am still getting my head around SSR and what to put where

albrookesplowman avatar Nov 06 '18 13:11 albrookesplowman