Skip to content

Commit b1d0bb4

Browse files
committed
COLUMBIA: Auth2 external access services use a well-known key to track auth
1 parent f8d6216 commit b1d0bb4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/state/selectors/auth.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ export const selectCurrentAuthServices = createSelector(
8181
const probeServices = anyProbeServices(resource);
8282
const probeServiceServices = flatten(probeServices.map(p => Utils.getServices(p)));
8383

84+
const allAuthServices = resourceServices.concat(probeServiceServices);
85+
8486
for (const authProfile of serviceProfiles) {
85-
const profiledAuthServices = resourceServices.concat(probeServiceServices).filter(
87+
const profiledAuthServices = allAuthServices.filter(
8688
p => authProfile.profile === p.getProfile(),
8789
);
8890

8991
for (const service of profiledAuthServices) {
9092
lastAttemptedService = service;
9193
// external service may have no id to track by (auth1 vs auth2)
92-
const serviceKey = (authProfile.external) ? (service?.id || 'external') : service?.id;
94+
const serviceKey = (authProfile.external) ? 'external' : service?.id;
9395

9496
if (!auth[serviceKey] || auth[serviceKey].isFetching || auth[serviceKey].ok) {
9597
return service;
@@ -103,10 +105,11 @@ export const selectCurrentAuthServices = createSelector(
103105
return Object.values(currentAuthServices.reduce((h, service) => {
104106
if (!service) return h;
105107
const external = serviceProfiles.filter(x => x.external).find(s => (s.profile === service.getProfile()));
106-
const serviceKey = (external) ? (service.id || 'external') : service.id;
108+
const serviceKey = (external) ? 'external' : service.id;
107109
if (!h[serviceKey]) {
108110
h[serviceKey] = service; // eslint-disable-line no-param-reassign
109111
}
112+
110113
return h;
111114
}, {}));
112115
},

0 commit comments

Comments
 (0)