-
Notifications
You must be signed in to change notification settings - Fork 997
Description
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:
- User initiates login in Chrome/Safari.
- Redirect to LINE occurs.
- The native LINE app opens.
- After successful authentication, LINE redirects back.
- The redirect does NOT return to the original browser.
- Instead, it opens inside LINE's in-app WebView.
- Firebase cannot find the stored OAuth state.
- 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
- Install LINE app on a mobile device.
- Open the web app in Chrome (Android) or Safari (iOS).
- Click "Login with LINE".
- LINE app opens.
- Complete authentication.
- 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);
};