Refactor getCredential function to support shorthand credential types: 'd' for Default, 'cs' for ClientSecret, and 'dc' for DeviceCode. Remove obsolete client-secret-login script.
This commit is contained in:
@@ -11,8 +11,10 @@ import { DefaultAzureCredential, ClientSecretCredential, DeviceCodeCredential }
|
||||
|
||||
export async function getCredential(credentialType, options) {
|
||||
switch (credentialType) {
|
||||
case "d":
|
||||
case "default":
|
||||
return new DefaultAzureCredential();
|
||||
case "cs":
|
||||
case "clientSecret":
|
||||
if (!options.tenantId || !options.clientId || !options.clientSecret) {
|
||||
throw new Error("tenantId, clientId, and clientSecret are required for ClientSecretCredential");
|
||||
@@ -22,6 +24,7 @@ export async function getCredential(credentialType, options) {
|
||||
options.clientId,
|
||||
options.clientSecret
|
||||
);
|
||||
case "dc":
|
||||
case "deviceCode":
|
||||
if (!options.tenantId || !options.clientId) {
|
||||
throw new Error("tenantId and clientId are required for DeviceCodeCredential");
|
||||
|
||||
Reference in New Issue
Block a user