fix: Facebook Limited Login not workind due to incorrect domain in JWT validation (#9120)
This commit is contained in:
@@ -2081,7 +2081,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
|
|
||||||
it('should use algorithm from key header to verify id_token', async () => {
|
it('should use algorithm from key header to verify id_token', async () => {
|
||||||
const fakeClaim = {
|
const fakeClaim = {
|
||||||
iss: 'https://facebook.com',
|
iss: 'https://www.facebook.com',
|
||||||
aud: 'secret',
|
aud: 'secret',
|
||||||
exp: Date.now(),
|
exp: Date.now(),
|
||||||
sub: 'the_user_id',
|
sub: 'the_user_id',
|
||||||
@@ -2145,7 +2145,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
|
|
||||||
it('(using client id as string) should verify id_token', async () => {
|
it('(using client id as string) should verify id_token', async () => {
|
||||||
const fakeClaim = {
|
const fakeClaim = {
|
||||||
iss: 'https://facebook.com',
|
iss: 'https://www.facebook.com',
|
||||||
aud: 'secret',
|
aud: 'secret',
|
||||||
exp: Date.now(),
|
exp: Date.now(),
|
||||||
sub: 'the_user_id',
|
sub: 'the_user_id',
|
||||||
@@ -2172,7 +2172,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
|
|
||||||
it('(using client id as array) should verify id_token', async () => {
|
it('(using client id as array) should verify id_token', async () => {
|
||||||
const fakeClaim = {
|
const fakeClaim = {
|
||||||
iss: 'https://facebook.com',
|
iss: 'https://www.facebook.com',
|
||||||
aud: 'secret',
|
aud: 'secret',
|
||||||
exp: Date.now(),
|
exp: Date.now(),
|
||||||
sub: 'the_user_id',
|
sub: 'the_user_id',
|
||||||
@@ -2199,7 +2199,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
|
|
||||||
it('(using client id as array with multiple items) should verify id_token', async () => {
|
it('(using client id as array with multiple items) should verify id_token', async () => {
|
||||||
const fakeClaim = {
|
const fakeClaim = {
|
||||||
iss: 'https://facebook.com',
|
iss: 'https://www.facebook.com',
|
||||||
aud: 'secret',
|
aud: 'secret',
|
||||||
exp: Date.now(),
|
exp: Date.now(),
|
||||||
sub: 'the_user_id',
|
sub: 'the_user_id',
|
||||||
@@ -2250,7 +2250,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toBe(
|
expect(e.message).toBe(
|
||||||
'id token not issued by correct OpenID provider - expected: https://facebook.com | from: https://not.facebook.com'
|
'id token not issued by correct OpenID provider - expected: https://www.facebook.com | from: https://not.facebook.com'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2286,7 +2286,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toBe(
|
expect(e.message).toBe(
|
||||||
'id token not issued by correct OpenID provider - expected: https://facebook.com | from: https://not.facebook.com'
|
'id token not issued by correct OpenID provider - expected: https://www.facebook.com | from: https://not.facebook.com'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2320,7 +2320,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toBe(
|
expect(e.message).toBe(
|
||||||
'id token not issued by correct OpenID provider - expected: https://facebook.com | from: https://not.facebook.com'
|
'id token not issued by correct OpenID provider - expected: https://www.facebook.com | from: https://not.facebook.com'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2378,7 +2378,7 @@ describe('facebook limited auth adapter', () => {
|
|||||||
|
|
||||||
it('should throw error with with invalid user id', async () => {
|
it('should throw error with with invalid user id', async () => {
|
||||||
const fakeClaim = {
|
const fakeClaim = {
|
||||||
iss: 'https://facebook.com',
|
iss: 'https://www.facebook.com',
|
||||||
aud: 'invalid_client_id',
|
aud: 'invalid_client_id',
|
||||||
sub: 'a_different_user_id',
|
sub: 'a_different_user_id',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const jwt = require('jsonwebtoken');
|
|||||||
const httpsRequest = require('./httpsRequest');
|
const httpsRequest = require('./httpsRequest');
|
||||||
const authUtils = require('./utils');
|
const authUtils = require('./utils');
|
||||||
|
|
||||||
const TOKEN_ISSUER = 'https://facebook.com';
|
const TOKEN_ISSUER = 'https://www.facebook.com';
|
||||||
|
|
||||||
function getAppSecretPath(authData, options = {}) {
|
function getAppSecretPath(authData, options = {}) {
|
||||||
const appSecret = options.appSecret;
|
const appSecret = options.appSecret;
|
||||||
|
|||||||
Reference in New Issue
Block a user