firebase / firebase/firebase-android-sdk

"Unable to process request due to missing initial state" when using startActivityForSignInWithProvider with Apple sign in

Open
#6,144 14 comments 8 reactions 0 assignees View on GitHub
api: auth
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 23h
Merged PRs (30d)
34

Description

### [REQUIRED] Step 2: Describe your environment

* Android Studio version: N/A. Visual Studio 2022 Version 17.10.5
* Firebase Component: Authentication
* Component version: 22.3.1.2

### [REQUIRED] Step 3: Describe the problem

#### Steps to reproduce:

Following [Authenticate Using Apple on Android](https://firebase.google.com/docs/auth/android/apple), I have this code (C# but it should be equivalent to Java):

```cs
var activity = await Platform.WaitForActivityAsync();
var provider = OAuthProvider.NewBuilder("apple.com").Build();

try
{
var authResult = await auth.StartActivityForSignInWithProvider(activity, provider).AsAsync();
FbUser = authResult.User;

return authResult.Credential;
}
catch (FirebaseAuthWebException ex)
{
if (ex.ErrorCode == "ERROR_WEB_CONTEXT_CANCELED")
{
return null;
}

throw;
}
```

After calling `StartActivityForSignInWithProvider`, an in-app browser is opened but after signing in successfully, this page opens instead:

![image](https://github.com/user-attachments/assets/4c59054b-f817-4590-b970-029a5a89cfd4)

Closing this page by pressing X on the top left corner also closes my app and the next time the app starts, it is stuck at the splash screen and has to be restarted.

#### Relevant Code:

See above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.