show proper authserverurl
This commit is contained in:
parent
73fde03aa4
commit
82858bed30
1 changed files with 49 additions and 30 deletions
|
|
@ -26,13 +26,13 @@ export const oauthTransitions: Record<OAuthStep, StateTransition> = {
|
|||
metadata_discovery: {
|
||||
canTransition: async () => true,
|
||||
execute: async (context) => {
|
||||
let authServerUrl = context.serverUrl;
|
||||
let authServerUrl = new URL(context.serverUrl);
|
||||
let resourceMetadata: OAuthProtectedResourceMetadata | null = null;
|
||||
let resourceMetadataError: Error | null = null;
|
||||
try {
|
||||
resourceMetadata = await discoverOAuthProtectedResourceMetadata(context.serverUrl);
|
||||
if (resourceMetadata && resourceMetadata.authorization_servers?.length) {
|
||||
authServerUrl = resourceMetadata.authorization_servers[0];
|
||||
authServerUrl = new URL(resourceMetadata.authorization_servers[0]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.info(`Failed to find protected resource metadata: ${e}`);
|
||||
|
|
@ -53,6 +53,7 @@ export const oauthTransitions: Record<OAuthStep, StateTransition> = {
|
|||
context.updateState({
|
||||
resourceMetadata,
|
||||
resourceMetadataError,
|
||||
authServerUrl,
|
||||
oauthMetadata: parsedMetadata,
|
||||
oauthStep: "client_registration",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue