Skip to content

LINE Login Fails on Mobile When LINE App Is Installed (Firebase Auth Redirect Flow) #9493

@leonx04

Description

@leonx04

Operating System

Androi, IOS browser (installed app LINE)

Environment (if applicable)

Chrome, Brave any version

Firebase SDK Version

12.5.0

Firebase SDK Product(s)

Auth

Project Tooling

  • Next.js 15(App Router)
  • React 18
  • Firebase JS SDK v12.5.0 (modular)
  • LINE Login via OpenID Connect (OIDC provider in Firebase)
  • Hosted on custom domain (not Firebase Hosting)
  • Mobile browsers: Chrome (Android), Safari (iOS)

Detailed Problem Description

Background

We are using Firebase Authentication (v12.5.0) with LINE as an OIDC provider.

Authentication is implemented using signInWithRedirect().

The project is deployed on a custom domain (not Firebase Hosting), and authDomain is set to the default firebaseapp.com domain as recommended.

What we are trying to achieve

Allow users to log in using LINE on both desktop and mobile browsers.

What actually happens

On mobile devices:

  • If the LINE app is NOT installed → Login works correctly.
  • If the LINE app IS installed → Login fails.

The login process gets stuck after redirecting back from LINE.

We receive the following error:

"Unable to process request due to missing initial state. This may happen if browser sessionStorage is inaccessible or accidentally cleared."

Observed behavior

When the LINE app is installed:

  1. User initiates login in Chrome/Safari.
  2. Redirect to LINE occurs.
  3. The native LINE app opens.
  4. After successful authentication, LINE redirects back.
  5. The redirect does NOT return to the original browser.
  6. Instead, it opens inside LINE's in-app WebView.
  7. Firebase cannot find the stored OAuth state.
  8. Authentication fails with "missing initial state".

This appears to be caused by browser context switching and sessionStorage isolation.

Console output

Error:

Unable to process request due to missing initial state.

In some configurations we also observed 404 errors for:

//auth/iframe
/
/auth/handler

However, after correcting authDomain configuration, the core issue remains when the LINE app is installed.

Steps and code to reproduce issue

Steps to reproduce

  1. Install LINE app on a mobile device.
  2. Open the web app in Chrome (Android) or Safari (iOS).
  3. Click "Login with LINE".
  4. LINE app opens.
  5. Complete authentication.
  6. Observe failure after redirect back.

If the LINE app is uninstalled, the login succeeds.

Minimal code example

import { getAuth, signInWithRedirect, OAuthProvider } from "firebase/auth";

const auth = getAuth();
const provider = new OAuthProvider("oidc.line");

const login = async () => {
  await signInWithRedirect(auth, provider);
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions