Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    3D-Printed Cinema Film Camera Oozes Vintage Vibes

    December 28, 2025

    Probing the fundamental nature of the Higgs Boson – Physics World

    December 28, 2025

    MIT Technology Review’s most popular stories of 2025

    December 28, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»Angular OIDC authentication fails on iOS because of invalid nonce in state
    iOS Development

    Angular OIDC authentication fails on iOS because of invalid nonce in state

    big tee tech hubBy big tee tech hubDecember 18, 2025012 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    Angular OIDC authentication fails on iOS because of invalid nonce in state
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I have an Angular (19) Application which uses the angular-oauth2-oidc (v19) package. I do initialize the OIDC code flow in the provideAppInitializer function. This application is called from inside an iOS native app (on iOS 26), which opens an in app browser (not really sure, which kind of, but could be of type SFSafariViewController). The in app browser is opened and navigates to my angular application which navigates to the login page of my IAM. After successfully entering the correct credentials an error is thrown resulting in a white screen for the user. When reloading the site manually, everything works fine and the user is successfully logged in.

    Error from debug console:

    Validating access_token failed, wrong state/nonce. **- null - "app"** oidc-Error: {"type":"invalid_nonce_in_state","reason":null,"params":null}

    The comparison tries to compare null to “app” which are no real nonces. “app” is initially (when calling the in app browser) given in the state-url parameter: state=app. This values should not be compared to anything. Which leads me to the assumption, that the method is called at the wrong time (race condition).

    The implementation works fine on desktop browser including Safari, Edge, Firefox…

    Initializing of oidc in my main.ts.

    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}
            },
    .
    .
    .
    

    my auth.config.ts:

    export const authConfig: AuthConfig = {
      issuer: environment.issuer,
      redirectUri: window.location.origin,
      logoutUrl: '
      postLogoutRedirectUri: window.location.origin,
      clientId: environment.clientId,
      responseType: 'code',
      scope: environment.scope,
      showDebugInformation: false,
      oidc: true,
      strictDiscoveryDocumentValidation: false,
    };
    

    When the nonce verification is turned of via { disableNonceCheck: true } everything works as expected.

    What is the reason for the error, or why is validateNonce calles with the wrong values on in app browser on iOS and not on desktop?
    How can this be fixed or implemented differently to work as expected?



    Source link

    Angular authentication Fails Invalid iOS nonce OIDC State
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – Background Assets Framework server connection problem

    December 27, 2025

    ios – SwiftUI-Button: Complete VStack clickable

    December 26, 2025

    ios – ld: framework ‘Pods_MyProjectName’ not found

    December 25, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    3D-Printed Cinema Film Camera Oozes Vintage Vibes

    December 28, 2025

    Probing the fundamental nature of the Higgs Boson – Physics World

    December 28, 2025

    MIT Technology Review’s most popular stories of 2025

    December 28, 2025

    Santa Claus doesn’t exist (according to AI) • Graham Cluley

    December 28, 2025
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    3D-Printed Cinema Film Camera Oozes Vintage Vibes

    December 28, 2025

    Probing the fundamental nature of the Higgs Boson – Physics World

    December 28, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.