Skip to content
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

bug(authentication): Bad access token when signing in via Facebook under iOS #834

Open
robingenz opened this issue Feb 26, 2025 · 2 comments
Assignees
Labels
bug/fix Something isn't working package: authentication platform: ios iOS platform

Comments

@robingenz
Copy link
Member

Discussed in #827

Originally posted by tbence94 February 21, 2025

The issue

Facebook FAQ here states the following:

In response to the upcoming changes to ATT enforcement, we made changes to the iOS SDK and the SDK no longer provides valid user access tokens in scenarios where the user opts out of ATT.
...
Our recommendation is that users integrate Limited Login following the official documentation:

As far as I can tell the current @capacitor-firebase/authentication package does not support this Limited Login on iOS.
That's why we got errors when tried to use this:

import { FirebaseAuthentication } from '@capacitor-firebase/authentication'

const result = await FirebaseAuthentication.signInWithFacebook()

The code above resulted in errors like these:

[ FirebaseAuthentication ]  Bad access token: {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"}`
[ FirebaseAuthentication ]  Bad access token: {"code":190,"message":"Invalid OAuth access token data."}

Always code 190 and some message about the token being "bad"/"malformed" etc...

Solution

I forked the repo and played in local until I managed to modify the FacebookAuthProviderHandler.swift code to use the limited login option and log in on my iOS device using the idToken. This also means that accessToken will no longer work!

These sources proved useful for the implementation:

Here is the implementation / diff:
main...YoloEdu:capacitor-firebase:main

Question

Should this change be merged into the original package?
I am no iOS developer and I am not really familiar with firebase either, so I am not really sure about this.

I feel this should be an issue for a lot of people who use this package for iOS facebook login.
But I did not see any opened issues or PRs regarding this problem.

Could someone take a look at my solution and decide if it's worth merging?

@robingenz
Copy link
Member Author

@ebarooni It would be great if you could help here. Please try to reproduce this issue. If you can reproduce it, try to fix it without any breaking changes.

@canercanbaz
Copy link

Hello, I am experiencing this issue.
I am looking forward to this being fixed. Thanks guys! ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/fix Something isn't working package: authentication platform: ios iOS platform
Projects
None yet
Development

No branches or pull requests

3 participants