Skip to content

Commit b98d752

Browse files
atrakhConvex, Inc.
authored andcommitted
Check for either convex audience in auth flow (#40010)
Valid auth0 tokens can also have the alternate convex audience GitOrigin-RevId: 8c6dd044524cfaa43e14c209e8bb47a8bd569fa7
1 parent 0bbb25f commit b98d752

File tree

1 file changed

+6
-7
lines changed
  • crates/authentication/src

1 file changed

+6
-7
lines changed

crates/authentication/src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,14 +717,13 @@ where
717717
"Access Token could not be decoded to determine provider type",
718718
))?;
719719

720-
let audience = payload.registered.audience;
721-
let is_auth0 = match audience {
720+
let is_auth0 = match payload.registered.audience {
722721
None => false,
723-
Some(aud) => match aud {
724-
biscuit::SingleOrMultiple::Multiple(auds) => auds
725-
.iter()
726-
.any(|audience| audience.contains("console.convex.dev")),
727-
biscuit::SingleOrMultiple::Single(aud) => aud.contains("console.convex.dev"),
722+
Some(biscuit::SingleOrMultiple::Multiple(auds)) => auds.iter().any(|audience| {
723+
audience == CONVEX_CONSOLE_API_AUDIENCE || audience == ALTERNATE_CONVEX_API_AUDIENCE
724+
}),
725+
Some(biscuit::SingleOrMultiple::Single(audience)) => {
726+
audience == CONVEX_CONSOLE_API_AUDIENCE || audience == ALTERNATE_CONVEX_API_AUDIENCE
728727
},
729728
};
730729

0 commit comments

Comments
 (0)