firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.41k stars 1.42k forks source link

Token mismatch using iOS 18 Beta 1 #13144

Open Meyssam120 opened 1 week ago

Meyssam120 commented 1 week ago

Description

I'm getting the following error when running my app on iOS 18 and requesting phoneAuthentication: Error Domain=FIRAuthErrorDomain Code=17048 "Token mismatch" UserInfo={NSLocalizedDescription=Token mismatch, FIRAuthErrorUserInfoNameKey=INVALID_APP_CREDENTIAL}. Before the update to iOS 18 everything worked normally. I triple checked the configuration and everything should be okay on my side. Everything's untouched except the iOS version. Strangely I could fix the issue by changing .prod -> .unknown in Auth.auth().setAPNSToken(deviceToken, type: .unknown) Messaging.messaging().setAPNSToken(deviceToken, type: .unknown)

Reproducing the issue

No response

Firebase SDK Version

10.28.0

Xcode Version

16.0 Beta (16A5171c)

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication, Firestore, Messaging, Storage

Targeted Platforms

iOS

Relevant Log Output

Error Domain=FIRAuthErrorDomain Code=17048 "Token mismatch" UserInfo={NSLocalizedDescription=Token mismatch, FIRAuthErrorUserInfoNameKey=INVALID_APP_CREDENTIAL}

If using Swift Package Manager, the project's Package.resolved

No response

If using CocoaPods, the project's Podfile.lock

No response

google-oss-bot commented 1 week ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

rizafran commented 1 week ago

Thanks for reporting, @Meyssam120. I tried to reproduce the issue on iOS 18 beta, but I can't get the same behavior. You mentioned that the issue was fixed by changing the APNs token type to .unknown, in which the actual token will be auto detected from your provisioning profile. The error you encountered usually happens when the APNs device token is either incorrect or doesn't match the certificate uploaded in the console.

With this, could you verify the following:

Meyssam120 commented 1 week ago

Hi @rizafran . For authentication I use an auth-key instead of a certificate. That's why I thought it must be .prod. I've checked all of your points and can confirm, that they are all set up correctly. In fact I downloaded a new .plist file before submitting this issue, because I thought it would solve it, which it didn't. Btw. I assume that the auth-key is correct and valid, because I am able to send a bunch of push notifications to my devices.

Hope that helps you

rizafran commented 6 days ago

Thanks for verifying, @Meyssam120. May I know if the issue occurred to all users or just in a specific region?

Meyssam120 commented 6 days ago

The app is not public yet, so I've only experienced myself in Germany.

rizafran commented 3 days ago

@Meyssam120, is it possible for you to provide a sample app that reproduces the issue? Also, are you reproducing it using a simulator or a physical device?