Solved

Unclear documentation: "2. Set Firebase User Identity in RevenueCat"

  • 18 November 2023
  • 4 replies
  • 65 views

Badge +6

Hello,

This documentation page is unclear: https://www.revenuecat.com/docs/firebase-integration#2-set-firebase-user-identity-in-revenuecat

It has an example in Swift. But I am developing application in Flutter.

I want to implement In-App Subscription Purchase, and after purchase made, I want to use Apple provided token, or even better Email, to authenticate to Firebase. Am I looking at correct documentation page? Any sample code for Flutter?
 

Flow: user makes purchase without any external authentication on iOS, using system provided authentication to App Store and making purchase; I need this <user> to be able to access Firebase as an authenticated user. 

Thanks

icon

Best answer by OzNick 18 November 2023, 02:43

View original

4 replies

Userlevel 1
Badge +4

Hi @Bamba,

I get the user to create their Firebase account first. createUserWithEmailAndPassword(), gather info then get them to login.

When they login, I set the app_user_id to the auth.currentuser.uid

If they don't have a subscription, I show subscription info and they can't get any further. 

They tap a button to open the bottom sheet(pay wall), and select and pay for their subscription.

Once the transaction is complete, the app opens up to allow the user full access.

 

MichaelC 

Badge +6

Hi @OzNick 

 

Thank you for sharing!

But what if another user uses the same Email address on another device? Or, the same user uses another Email on the same device?

Also, if user is not registered to Firebase, can some kind of “token” or “id” provided by App Store be used for authorization (and not authentication) at Firebase?

Your solution seems “bullet proof” but I was hoping App Store provides user Email to webhook, but not sure

Userlevel 1
Badge +4

I have run into an issue whereby,  no matter what email I use to log into the app on my S23U, payment always defaults to my google account, which is also my dev account, so I can only ever use test payments on this device.

 

I will try with my Apple account on the S23 and see what happens. 

Userlevel 1
Badge +4

Yep, as expected! 

I logged in with my Apple I'd, which has an active live subscription, but instead of seeing the app content, the subscription info screen is displayed, which is the usual behaviour if you don't have a subscription. 

Then, when I went to purchase a subscription, I was presented with test payment options. 

I think that is more a Google thing rather than an RC thing. Although, the Apple account wasn't recognised on the Android device. 

Logging into the Android device and tapping restore purchases, had no effect on either device. The account on iPhone still functions normally. 

Maybe an RC rep can shed some light into why we can't use different devices (Apple or Android) for one account.?

 

Reply