Fehler in der Debug-Konsole:
Code: Select all
Validating access_token failed, wrong state/nonce. **- null - "app"** oidc-Error: {"type":"invalid_nonce_in_state","reason":null,"params":null}Die Implementierung funktioniert gut auf Desktop-Browsern, einschließlich Safari, Edge, Firefox...
Initialisierung von oidc in meiner main.ts.
Code: Select all
const oidcInitializer = async () => {
const oauthService = inject(OAuthService);
oauthService.configure(authConfig);
await oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
if (!oauthService.hasValidAccessToken()) {
oauthService.initLoginFlow();
}
}).catch(() => {
return Promise.resolve();
});
};
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(BrowserModule, ReactiveFormsModule),
{
provide: ErrorHandler,
useClass: GlobalErrorHandler,
},
provideHttpClient(),
provideOAuthClient(),
provideAppInitializer(oidcInitializer),
provideRouter([
{
path: '',
component: MainComponent,
canActivate: [AuthGuard],
resolve: {state: StateResolver}
},
.
.
.
Code: Select all
export const authConfig: AuthConfig = {
issuer: environment.issuer,
redirectUri: window.location.origin,
logoutUrl: 'https://XXX/LogoutPage.html',
postLogoutRedirectUri: window.location.origin,
clientId: environment.clientId,
responseType: 'code',
scope: environment.scope,
showDebugInformation: false,
oidc: true,
strictDiscoveryDocumentValidation: false,
};
Was ist der Grund für den Fehler oder warum werden ValidateNonce-Aufrufe mit den falschen Werten im App-Browser auf iOS und nicht auf dem Desktop aktiviert?
Wie kann dies behoben oder anders implementiert werden, damit es wie erwartet funktioniert?
Mobile version