-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
authorizationCodeCredential.browser.ts
38 lines (34 loc) · 1.2 KB
/
authorizationCodeCredential.browser.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { TokenCredential, AccessToken } from "@azure/core-http";
import { TokenCredentialOptions } from "../client/identityClient";
import { credentialLogger, formatError } from "../util/logging";
const BrowserNotSupportedError = new Error(
"AuthorizationCodeCredential is not supported in the browser. InteractiveBrowserCredential is more appropriate for this use case."
);
const logger = credentialLogger("AuthorizationCodeCredential");
export class AuthorizationCodeCredential implements TokenCredential {
constructor(
tenantId: string | "common",
clientId: string,
clientSecret: string,
authorizationCode: string,
redirectUri: string,
options?: TokenCredentialOptions
);
constructor(
tenantId: string | "common",
clientId: string,
authorizationCode: string,
redirectUri: string,
options?: TokenCredentialOptions
);
constructor() {
logger.info(formatError("", BrowserNotSupportedError));
throw BrowserNotSupportedError;
}
public getToken(): Promise<AccessToken | null> {
logger.getToken.info(formatError("", BrowserNotSupportedError));
throw BrowserNotSupportedError;
}
}