Skip to content

Implement Firebase Auth UseUserAccessGroup for C++ SDK #1758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

jonsimantov
Copy link
Contributor

This commit adds the UseUserAccessGroup method to the Firebase C++ Auth SDK. This method is only functional on iOS and acts as a no-op stub on other platforms (Android, desktop).

It wraps the [FIRAuth useUserAccessGroup:error:] Objective-C method on iOS, allowing C++ developers to specify a keychain access group for sharing authentication data between apps.

Key changes:

  • Added UseUserAccessGroup to the public Auth class in auth.h.
  • Implemented the iOS-specific logic in auth_ios.mm.
  • Provided stub implementations in auth_stub.cc (for desktop) and auth_android.cc (for Android).

Description

Provide details of the change, and generalize the change in the PR title above.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

This commit adds the UseUserAccessGroup method to the Firebase C++ Auth SDK.
This method is only functional on iOS and acts as a no-op stub on other platforms (Android, desktop).

It wraps the [FIRAuth useUserAccessGroup:error:] Objective-C method on iOS, allowing C++ developers to specify a keychain access group for sharing authentication data between apps.

Key changes:
- Added UseUserAccessGroup to the public Auth class in auth.h.
- Implemented the iOS-specific logic in auth_ios.mm.
- Provided stub implementations in auth_stub.cc (for desktop) and auth_android.cc (for Android).
Copy link
Contributor Author

@jonsimantov jonsimantov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a very simple integration test case in auth/integration_test/src/integration_test.cc? You can run it on all platforms and just ensure that the method call doesn't crash, no need to check the error results.

@@ -0,0 +1,35 @@
// Copyright 2023 Google LLC
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not exist, please put the stub implementations in the Android and Desktop files that already exist.

auth/src/auth.cc Outdated
@@ -373,5 +373,18 @@ AUTH_RESULT_FN(Auth, SignInWithEmailAndPassword, AuthResult)

AUTH_RESULT_FN(Auth, CreateUserWithEmailAndPassword, AuthResult)

// Platform-specific implementation of UseUserAccessGroup.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't pu tthe platform-specific implementation here, put it in auth_android and auth_desktop and auth_ios.

@@ -676,5 +676,14 @@ void DisableTokenAutoRefresh(AuthData* auth_data) {}
void InitializeTokenRefresher(AuthData* auth_data) {}
void DestroyTokenRefresher(AuthData* auth_data) {}

// Stub implementation for UseUserAccessGroupInternal on Android.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desktop needs this too.

- Moved stub implementations from auth_stub.cc to auth_desktop.cc and auth_android.cc.
- Removed auth_stub.cc.
- Removed unnecessary forward declaration for UseUserAccessGroupInternal from auth.cc.
- Added a basic integration test for UseUserAccessGroup to ensure it doesn't crash on any platform.
@firebase firebase locked and limited conversation to collaborators Jul 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant