facebook / facebook/facebook-ios-sdk

Feature Request: LimitedLoginRefreshResult should expose the raw nonce for Firebase OIDC credential construction

Open
#3,915 0 comments 0 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Swift
Stars
8.1k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

### Checklist before submitting a feature request

- [x] I've updated to the latest released version of the SDK
- [x] I've searched for existing [Github issues](https://github.com/facebook/facebook-ios-sdk/issues)
- [x] I've read the [Code of Conduct](https://github.com/facebook/facebook-ios-sdk/blob/main/CODE_OF_CONDUCT.md)

### Goals

refreshLimitedLogin (SDK 18.1.0) returns a LimitedLoginRefreshResult containing the refreshed AuthenticationToken, but does not expose the raw (unhashed) nonce that was generated internally for the refresh.

Firebase Auth's OAuthProvider.credential(providerID:idToken:rawNonce:) requires the raw nonce to validate the OIDC token. Without it, apps using Firebase as their auth backend cannot construct a credential from a refreshed token, which means refreshLimitedLogin cannot be used for Firebase re-authentication.

Request: Add a nonce: String property to LimitedLoginRefreshResult containing the raw nonce, matching what the app provides during the initial LoginConfiguration(permissions:tracking:nonce:) flow.

Workaround: None. Apps using Firebase must skip re-authentication for Facebook and cannot use refreshLimitedLogin to obtain fresh credentials.

### Expected results

LimitedLoginRefreshResult includes a nonce: String property containing the raw (unhashed) nonce generated internally by the SDK for the refresh. This allows the app to pass it to OAuthProvider.credential(providerID:idToken:rawNonce:) to construct a valid Firebase OIDC credential from the refreshed token.

### Code samples & details

```// Initial login works — app controls the nonce:
let rawNonce = Crypto.randomNonceString()
let config = LoginConfiguration( permissions: ["email"], tracking: .limited, nonce: rawNonce.hash(.sha256, as: .hex)! )
// ... after login:
let credential = OAuthProvider.credential( providerID: .facebook, idToken: authToken.tokenString, rawNonce: rawNonce ) // ✅

// Refresh doesn't work — SDK controls the nonce:
LoginManager().refreshLimitedLogin( fallbackPolicy: .automatic ) { result in
switch result {
case .success( let refreshResult ):
let credential = OAuthProvider.credential( providerID: .facebook, idToken: refreshResult.authenticationToken.tokenString, rawNonce: ??? ) // ❌ no raw nonce available
}
}

```

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.