# Error after upgrading to latest version: AuthSdkError: Passed in oktaAuth is not compatible with the SDK, minimum supported okta-auth-js version is 5.3.1

**URL:** <https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913>\
**Category:** OAuth/OIDC\
**Tags:** angular, authjs\
**Created:** [February 20, 2024, 2:31pm UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913 "2024-02-20T14:31:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rnataraj](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@rnataraj](https://devforum.okta.com/u/rnataraj)\
**Post date:** [February 20, 2024, 2:31pm UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/1 "2024-02-20T14:31:01Z")

</div>

Hi,  
We had to work on new laptop and upgrade the versions. I am using okta-auth-js of 7.5.1 but I am seeing error; “main.js:1 ERROR AuthSdkError: Passed in oktaAuth is not compatible with the SDK, minimum supported okta-auth-js version is 5.3.1.”  
How is this even possible? I am using 7.5.1 and its saying minimum is 5.3.1. It is higher than the version mentioned. can you please help?

Below is the configuration in package.json:  
“angular/animations”: “^17.1.3”,  
“angular/common”: “^17.1.3”,  
“angular/compiler”: “^17.0.0”,  
“angular/core”: “^17.1.3”,  
“angular/flex-layout”: “^15.0.0-beta.42”,  
“angular/forms”: “^17.1.3”,  
“angular/material”: “^17.1.2”,  
“angular/platform-browser”: “^17.1.3”,  
“angular/platform-browser-dynamic”: “^17.1.3”,  
“angular/platform-server”: “^17.1.3”,  
“angular/router”: “^17.1.3”,  
“okta/okta-angular”: “^6.3.2”,  
“okta/okta-auth-js”: “^7.5.1”,  
“okta/okta-signin-widget”: “^7.15.1”,  
“types/jquery”: “^3.5.29”,  
“aws-sdk”: “^2.1557.0”,  
“bootstrap”: “^5.2.3”,  
“jquery”: “^3.6.4”,  
“jwt-decode”: “^4.0.0”,  
“linqts”: “^1.15.0”,  
“lodash”: “^4.17.21”,  
“oidc-client”: “^1.11.5”,  
“popper.js”: “^1.16.0”,  
“run-script-os”: “^1.1.6”,  
“rxjs”: “~7.8.1”,  
“tslib”: “^2.5.0”,  
“zone.js”: “~0.14.4”

---

<div class="post-metadata">

**Author:** ![alisaduncan](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/alisaduncan/32/3429_2.png) [@alisaduncan](https://devforum.okta.com/u/alisaduncan)\
**Post date:** [February 20, 2024, 3:12pm UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/2 "2024-02-20T15:12:13Z")

</div>

Hi there @rnataraj !

Welcome to the community! This error might have something to do with how you are calling the `oktaAuth` service. In okta-angular v5, the passed in `oktaAuth` utilizes an injection token like this:

```ts
import { Component, Inject, OnInit } from '@angular/core';
import { OKTA_AUTH } from '@okta/okta-angular';
import { OktaAuth } from '@okta/okta-auth-js';

@Component({
  selector: 'app-component',
  template: `
    <pre id="userinfo-container">{{ user }}</pre>
  `,
})
export class MyProtectedComponent implements OnInit {
  user: string = '';
  constructor(@Inject(OKTA_AUTH) private oktaAuth: OktaAuth) {}
  
  async ngOnInit() {
    const user = await this.oktaAuth.getUser();
    this.user = JSON.stringify(user, null, 4);
  }
}

```

> **[GitHub - okta/okta-angular: Angular SDK for Okta's OIDC flow](https://github.com/okta/okta-angular?tab=readme-ov-file#okta_auth)**
>
> Angular SDK for Okta's OIDC flow. Contribute to okta/okta-angular development by creating an account on GitHub.

If it helps, here’s an example of an Angular project using versions more closely aligned with yours. I just verified it runs if I update the okta-auth-js version to the latest.

> **[GitHub - alisaduncan/okta-angular-standalone-example: Example standalone...](https://github.com/alisaduncan/okta-angular-standalone-example)**
>
> Example standalone Angular + Okta application. Contribute to alisaduncan/okta-angular-standalone-example development by creating an account on GitHub.

Let us know how it goes!

---

<div class="post-metadata">

**Author:** ![rnataraj](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@rnataraj](https://devforum.okta.com/u/rnataraj)\
**Post date:** [February 20, 2024, 4:37pm UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/4 "2024-02-20T16:37:34Z")

</div>

Thanks for the sample Code.  
Let me try it out and shall update

---

<div class="post-metadata">

**Author:** ![pmoda](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pmoda](https://devforum.okta.com/u/pmoda)\
**Post date:** [February 22, 2024, 4:57pm UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/5 "2024-02-22T16:57:35Z")

</div>

Hi @alisaduncan , I am facing similar error. And using okta sign in widget of our company in our application. And  
I tried to incorporate the way okta is being called now. I pasted my code for reference. Can you please take a look and let us know what might be going wrong for okta to be throwing error? Using latest okta versions…

below is app.component.ts:  
export class AppComponent implements OnInit {  
public isAuthenticated$!: Observable;  
private oktaStateService = inject(OktaAuthStateService);  
private oktaAuth = inject(OKTA\_AUTH);  
public ngOnInit(): void {  
this.isAuthenticated$ = this.oktaStateService.authState$.pipe(  
filter((s: AuthState) =\> !!s),  
map((s: AuthState) =\> s.isAuthenticated ?? false)  
);  
}

public async signIn(): Promise {  
await this.oktaAuth.signInWithRedirect();  
}

public async signOut(): Promise {  
await this.oktaAuth.signOut();  
}  
}  
And here is app.module.ts:  
const oktaConfig: OktaAuthOptions = {  
scopes: [‘profile’, ‘openid’, ‘groups’, ‘email’]

};

@NgModule({  
declarations: [  
AppComponent,  
HomeComponent,  
LoginComponent,  
HeaderComponent,  
FooterComponent,  
ThankyouComponent  
],  
imports: [  
BrowserModule,  
HttpClientModule,  
BrowserAnimationsModule,  
FlexLayoutModule,  
MatToolbarModule,  
MatMenuModule,  
MatIconModule,  
MatCardModule,  
MatButtonModule,  
MatTableModule,  
MatDividerModule,  
AppRoutingModule,  
OktaAuthModule,  
MatFormFieldModule,  
FormsModule,  
MatInputModule,  
MatOptionModule,  
MatSelectModule,  
MatSlideToggleModule,  
MatProgressSpinnerModule,  
MatSortModule,  
MatPaginatorModule,  
ReactiveFormsModule,  
MatNativeDateModule,  
MatRadioModule,  
MatTooltipModule,  
MatSelectModule,  
MatSortModule,  
MatTabsModule,  
MatDialogModule,  
MatDatepickerModule,  
MatCheckboxModule  
],  
providers:  
[  
{ provide: OKTA\_CONFIG, useValue: { oktaAuth: oktaConfig } }  
],  
bootstrap: [AppComponent]  
})  
export class AppModule {  
}  
and below is login.component.ts:  
export class LoginComponent implements OnInit {  
widget = new OktaSignIn({  
scopes: [‘profile’, ‘openid’, ‘groups’, ‘email’]  
});  
isAuthenticated = false;  
constructor(@Inject(OKTA\_AUTH) public oktaAuth: OktaAuth, private authStateService: OktaAuthStateService, private router: Router) {  
if (this.isAuthenticated) {  
this.router.navigate([‘/home’]);  
}  
// Show the widget when prompted, otherwise remove it from the DOM.  
router.events.forEach(event =\> {  
if (event instanceof NavigationStart) {  
switch (event.url) {  
case ‘/login’:  
break;  
default:  
this.widget.remove();  
break;  
}  
}  
});  
}  
ngOnInit(): void {  
if (this.isAuthenticated) {  
this.router.navigate([‘/home’]);  
}  
this.widget.showSignInToGetTokens({  
el: ‘#okta-signin-container’  
}).then(async (tokens: Tokens | undefined) =\> {  
const originalUri = this.oktaAuth.getOriginalUri();  
if (originalUri === DEFAULT\_ORIGINAL\_URI) {  
this.oktaAuth.setOriginalUri(‘/’);  
}  
await this.oktaAuth.signInWithRedirect().then(  
\_ =\> this.router.navigate([‘/home’])  
);  
}).catch((err: any) =\> {  
// Typically due to misconfiguration  
throw err;  
});  
}  
}

---

<div class="post-metadata">

**Author:** ![alisaduncan](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/alisaduncan/32/3429_2.png) [@alisaduncan](https://devforum.okta.com/u/alisaduncan)\
**Post date:** [February 24, 2024, 12:51am UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/6 "2024-02-24T00:51:24Z")

</div>

Hey there @pmoda !

I’m sorry to hear you’re seeing this error. I haven’t worked on code using the Okta sign-in widget in a while, so I think your best bet is to check out the samples. Have you tried comparing your code to this one?

> <https://github.com/okta/samples-js-angular/tree/master/custom-login>
>
> //github.com/okta/samples-js-angular/tree/master/custom-login

Let us know how it goes!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [March 25, 2024, 12:51am UTC](https://devforum.okta.com/t/error-after-upgrading-to-latest-version-authsdkerror-passed-in-oktaauth-is-not-compatible-with-the-sdk-minimum-supported-okta-auth-js-version-is-5-3-1/26913/7 "2024-03-25T00:51:59Z")

</div>

Closed on March 25, 2024, 12:51am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
