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

[INJIMOB-2985] make authorization_servers optional and add fallback logic #1813

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

abhip2565
Copy link
Contributor

@abhip2565 abhip2565 commented Feb 24, 2025

Description

make authorization_servers optional and add fallback logic

Issue ticket number and link

INJIMOB-2985

await CACHED_API.fetchIssuerAuthorizationServerMetadata(server);

if (
(authorizationServersMetadata?.['grant_types_supported'] || ["authorization_code", "implicit"]).some(grant =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract ["authorization_code", "implicit"] as constant outside for loop.
It looks complex to understand if condition. If we name it defaultGrantTypeSupported, it will be more readable.

return authorizationServerMetadata['authorization_endpoint'];

throw new Error(
OIDCErrors.AUTHORIZATION_ENDPOINT_DISCOVERY.GRANT_TYPE_NOT_SUPPORTED,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel, instead of giving GRANT_TYPE_NOT_SUPPORTED we should have generic error like failed to fetch data.
Definite error should be used if we will get that error only.

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

Successfully merging this pull request may close these issues.

3 participants