mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor: reorder code
This commit is contained in:
parent
5ea8c49c5d
commit
55e04cc683
1 changed files with 7 additions and 6 deletions
|
@ -217,12 +217,6 @@ export default function initOidc(
|
|||
|
||||
try {
|
||||
const isTokenClientCredentials = token instanceof ctx.oidc.provider.ClientCredentials;
|
||||
const pickedFields = isTokenClientCredentials
|
||||
? ctx.oidc.provider.ClientCredentials.IN_PAYLOAD
|
||||
: ctx.oidc.provider.AccessToken.IN_PAYLOAD;
|
||||
const readOnlyToken = Object.fromEntries(
|
||||
pickedFields.map((field) => [field, Reflect.get(token, field)])
|
||||
);
|
||||
|
||||
const { script, envVars } =
|
||||
(await trySafe(
|
||||
|
@ -237,6 +231,13 @@ export default function initOidc(
|
|||
return;
|
||||
}
|
||||
|
||||
const pickedFields = isTokenClientCredentials
|
||||
? ctx.oidc.provider.ClientCredentials.IN_PAYLOAD
|
||||
: ctx.oidc.provider.AccessToken.IN_PAYLOAD;
|
||||
const readOnlyToken = Object.fromEntries(
|
||||
pickedFields.map((field) => [field, Reflect.get(token, field)])
|
||||
);
|
||||
|
||||
const client = await cloudConnection.getClient();
|
||||
|
||||
// We pass context to the cloud API only when it is a user's access token.
|
||||
|
|
Loading…
Reference in a new issue