OktaAuthModule.initAuth is not a function

Hi all!
I tried this example Okta Sign-In Widget and Angular and in app.module.ts I got an error in browser

app.module.ts:79 Uncaught TypeError: okta_okta_angular__WEBPACK_IMPORTED_MODULE_17_.OktaAuthModule.initAuth is not a function

and there is the same error in Visual Studio Code

Property ‘initAuth’ does not exist on type ‘typeof OktaAuthModule’.ts(2339)

Does anybody have any ideas why OktaAuthModule.initAuth() does not exist?


I have the same problem. I came here after following this tutorial: https://developer.okta.com/blog/2018/08/22/basic-crud-angular-7-and-spring-boot-2#oktas-angular-support

and I’m getting that same
Property 'initAuth' does not exist on type 'typeof OktaAuthModule'.

I figured out my problem. I was using version 2.0 of @okta/okta-angular when I should’ve been using version 1.x

It seems the example is old.
I recreated my application using this example

Check this for the current version: https://www.npmjs.com/package/@okta/okta-angular#usage