From 3b27713609921da93fd89db68905c54c5518f7e4 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:42:45 +0000 Subject: [PATCH 1/3] fix --- spec/ParseUser.spec.js | 13 +++++++++++++ src/Adapters/Auth/index.js | 17 +++++++++++++++++ src/RestQuery.js | 15 +++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index aaae271332..48ae1d2a9c 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -1395,6 +1395,19 @@ describe('Parse.User testing', () => { }); }); + it('should return authData when select authData with masterKey', async () => { + const provider = getMockFacebookProvider(); + Parse.User._registerAuthenticationProvider(provider); + const user = await Parse.User._logInWith('facebook'); + const query = new Parse.Query(Parse.User); + query.select('authData'); + const result = await query.get(user.id, { useMasterKey: true }); + expect(result.get('authData')).toBeDefined(); + expect(result.get('authData').facebook).toBeDefined(); + expect(result.get('authData').facebook.id).toBe('8675309'); + expect(result.get('authData').facebook.access_token).toBe('jenny'); + }); + it('only creates a single session for an installation / user pair (#2885)', async done => { Parse.Object.disableSingleInstance(); const provider = getMockFacebookProvider(); diff --git a/src/Adapters/Auth/index.js b/src/Adapters/Auth/index.js index 7f5581da49..7709b2b2eb 100755 --- a/src/Adapters/Auth/index.js +++ b/src/Adapters/Auth/index.js @@ -254,8 +254,25 @@ module.exports = function (authOptions = {}, enableAnonymousUsers = true) { ); }; + // Returns the list of auth provider names that have a valid adapter configured. + // This includes both built-in providers and custom providers from authOptions. + const getProviders = function () { + const allProviders = new Set([...Object.keys(providers), ...Object.keys(authOptions)]); + if (!_enableAnonymousUsers) { + allProviders.delete('anonymous'); + } + return [...allProviders].filter(provider => { + try { + return !!loadAuthAdapter(provider, authOptions); + } catch (e) { + return false; + } + }); + }; + return Object.freeze({ getValidatorForProvider, + getProviders, setEnableAnonymousUsers, runAfterFind, }); diff --git a/src/RestQuery.js b/src/RestQuery.js index 2064ffd0df..dfc9d5fa9a 100644 --- a/src/RestQuery.js +++ b/src/RestQuery.js @@ -751,6 +751,21 @@ _UnsafeRestQuery.prototype.runFind = async function (options = {}) { findOptions.keys = this.keys.map(key => { return key.split('.')[0]; }); + // When selecting authData on _User, also add the internal auth data fields + // (e.g. _auth_data_facebook) for each configured auth provider. In MongoDB, + // authData is stored as individual _auth_data_ fields, so the + // projection for 'authData' alone won't match them. Adding both ensures it + // works across all database adapters: Mongo uses _auth_data_* fields, + // Postgres uses the authData column directly. + if (this.className === '_User' && findOptions.keys.includes('authData')) { + const providers = this.config.authDataManager.getProviders(); + for (const provider of providers) { + const key = `_auth_data_${provider}`; + if (!findOptions.keys.includes(key)) { + findOptions.keys.push(key); + } + } + } } if (options.op) { findOptions.op = options.op; From f52fe00fcaeafec4e17db0bd72f4eb5eeb2c48e9 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:53:49 +0000 Subject: [PATCH 2/3] docs --- src/RestQuery.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/RestQuery.js b/src/RestQuery.js index dfc9d5fa9a..76535d5edc 100644 --- a/src/RestQuery.js +++ b/src/RestQuery.js @@ -751,12 +751,17 @@ _UnsafeRestQuery.prototype.runFind = async function (options = {}) { findOptions.keys = this.keys.map(key => { return key.split('.')[0]; }); - // When selecting authData on _User, also add the internal auth data fields - // (e.g. _auth_data_facebook) for each configured auth provider. In MongoDB, - // authData is stored as individual _auth_data_ fields, so the - // projection for 'authData' alone won't match them. Adding both ensures it - // works across all database adapters: Mongo uses _auth_data_* fields, - // Postgres uses the authData column directly. + // When selecting `authData` on `_User`, also add the internal auth data fields + // (e.g. `_auth_data_facebook`) for each configured auth provider. In MongoDB, + // `authData` is stored as individual `_auth_data_` fields, so the + // projection for `authData` alone won't match them. Adding both ensures it + // works across all database adapters: Mongo uses `_auth_data_*` fields, + // Postgres uses the `authData` column directly. + // + // Note: When selecting `authData`, only auth data of currently configured + // providers is returned. Auth data entries of providers that are no longer + // configured won't be included. To return all auth data regardless of the + // provider configuration, do not use `authData` as a selected key. if (this.className === '_User' && findOptions.keys.includes('authData')) { const providers = this.config.authDataManager.getProviders(); for (const provider of providers) { From 48e5eadbbbb223b8483ff7a95f492034fc158401 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Thu, 12 Feb 2026 20:33:42 +0000 Subject: [PATCH 3/3] lint --- src/Adapters/Auth/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapters/Auth/index.js b/src/Adapters/Auth/index.js index 7709b2b2eb..7c4f0e7011 100755 --- a/src/Adapters/Auth/index.js +++ b/src/Adapters/Auth/index.js @@ -264,7 +264,7 @@ module.exports = function (authOptions = {}, enableAnonymousUsers = true) { return [...allProviders].filter(provider => { try { return !!loadAuthAdapter(provider, authOptions); - } catch (e) { + } catch { return false; } });