benbaran / adal-angular4

Angular 4/5/6/7 ADAL Wrapper
MIT License
86 stars 104 forks source link

NodeInvocationException: Prerendering failed because of error: ReferenceError: window is not defined #21

Open karthik-15 opened 7 years ago

karthik-15 commented 7 years ago

Hi Everyone,

Created a basic application which uses this package of version 1.1.10.

I am getting an error after running the application called as "NodeInvocationException: Prerendering failed because of error: ReferenceError: window is not defined".

I am using web pack. The error which i am getting is in the file "main-server.js". Below is the code which is causing the issue.

window.Logging = {
        level: 0,
        log: function (message) { }
    };

After removing the package and its dependencies from the code, the application is working fine and the above code is not present in the "main-server.js".

Is any one else getting this issue? If Yes, is there any work around?

LoulG commented 6 years ago

Hi, same here. Did you find a workaround ?

anz1e commented 6 years ago

Hi, I´m running into the same issue(using Angular Universal) and building on a .Net Core SPA template, do you have a workaround for this?

karthik-15 commented 6 years ago

Hi,

I tried different packages but none of it worked. Later i followed the below article.

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code

I am preparing the login and logout urls and redirecting to it from the application to get the token.

Hope this helps.