Angular Okta Integration without login button or link

Hi,

I am trying to integrate Okta with our angular application which is already in prod using windows authentication. I am replacing Windows authentication with Okta authentication and authorization. I am following the sample example of resource server give here https://github.com/okta/samples-js-angular/tree/master/okta-hosted-login

which works. However the sample application has login link which user has to click to login into the application. I want login to happen when angular application loads. So I put this line this.oktaAuth.loginRedirect() in app.component.ts under ngOnInit event. However it does not work, post application load it redirects to Okta however post Okta login it goes into indefinite loop. If I use login link as provided in the example then it works but not without it. All the examples available on web either use a login link or button which I don’t want. Has someone tried this and if yes then how?

Even I tried this in the sample app provided at the link given above and there too it goes into indefinite loop post Okta login. I don’t see this requirement i.e. login without login link/button out of the world. Is this the limitation if current Okta api?

Any pointers in this regard would be highly appreciated.

Thanks,
Amit Kale