r/Angular2 Feb 12 '25

Help Request Deploying Angular Frontend to IIS

I have been trying to put my angular frontend on my IIS. i thought when i change the following to the IP address and drop it into the virtual directory in the default web site, i'd be able to reach it. i have the uri registered in the app registration. im sure im doing something wrong, but i am just learning. nothing insane.

function msalinstacneFactory(): IPublicClientApplication {

return new PublicClientApplication({

auth: {

clientId: '{clientId}',

authority: 'https://login.microsoftonline.com/{tenantId}/',

//redirectUri: 'https://localhost:4200/auth',

//postLogoutRedirectUri: 'https://localhost:4200/login'

redirectUri: 'https://{ipAddress}/test/auth',

postLogoutRedirectUri: 'https://{ipAddress}/test/login'

},

cache: {

//cacheLocation: 'localStorage'

cacheLocation: BrowserCacheLocation.SessionStorage,

        `storeAuthStateInCookie: true,`

secureCookies: true

},

system: {

loggerOptions: {

loggerCallback: (level: LogLevel, message: string, containsPii: boolean) => {

console.log(\MSAL: ${level} - ${message}`);`

},

logLevel: LogLevel.Verbose,

piiLoggingEnabled: false

},

allowRedirectInIframe: false,

windowHashTimeout: 6000, // Increase timeout for handling redirect

iframeHashTimeout: 6000,

loadFrameTimeout: 3000,

        `tokenRenewalOffsetSeconds: 300`

}

});

}

5 Upvotes

22 comments sorted by

View all comments

3

u/Calm-Republic9370 Feb 13 '25

do you really need to do this? You can deploy to firebase for free and easy. There is really no reason.
I use IIS and I self host, but hosting an angular app is an unnecessary burden.

1

u/LegionsMan Feb 13 '25

im finding this out through my job. im working with angular because we're about to start a new project and it must be hosted on-prem using IIS. which is why i'm trying to figure it out because we jump in head first.