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

Getting Invalid Signature while validaing Facebook Limited Login's JWT #2416

Open
5 tasks done
Jay21022001 opened this issue May 7, 2024 · 4 comments
Open
5 tasks done

Comments

@Jay21022001
Copy link

Jay21022001 commented May 7, 2024

Checklist before submitting a bug report

Xcode version

1.1.1

Facebook iOS SDK version

17.0.1

Dependency Manager

Other / I don't know

SDK Framework

Login

Goals

While Verifying Facebook Limited Login JWT, The Signature should be verified, But It throws "invalid signature" Error

Expected results

The Signature should be verified successfully

Actual results

It throws an "Invalid Signature" Error

Error: invalid signature

Steps to reproduce

  1. Pass your nonce and get the JWT from the Facebook
  2. Call the Facebook's JWKS and get your Public key
  3. Verify the signature => It throws an Invalid Signature

Code samples & details

const decoded = jwt.decode(token, { complete: true });
const { kid, alg } = decoded.header;
const key = await this.getPublicKey(kid);
const signingKey = key.getPublicKey();
console.log(signingKey)
return jwt.verify(token, signingKey, {
    algorithms: [alg],
});

static async getPublicKey(kid) {
    const client = jwksClient({
    jwksUri: FACEBOOK_JWKS_URL,
    timeout: API_TIMEOUT
    });
    return client.getSigningKey(kid);
}
@Jay21022001
Copy link
Author

Anyone, Please help me with this issue.

@JuanEBrainium
Copy link

We are also experiencing this issue

@shkfaiz
Copy link

shkfaiz commented Jun 27, 2024

Anyone found the fix

@akrin-0
Copy link

akrin-0 commented Aug 28, 2024

Hello, I was looking for a solution to the same problem, what I realized is that there was no problem at the first place. Check this out:
#2442 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants