Created
August 7, 2020 01:11
-
-
Save jongio/b52d128c51eb2a55d45ce50e7d3b3fa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyTokenCredential implements coreHttp.TokenCredential { | |
public token: string; | |
public expiresOn: number; | |
constructor(token: string, expiresOn?: Date) { | |
this.token = token; | |
this.expiresOn = expiresOn | |
? expiresOn.getTime() | |
: Date.now() + 60 * 60 * 1000; | |
} | |
async getToken( | |
_scopes: string | string[], | |
_options?: coreHttp.GetTokenOptions | |
): Promise<coreHttp.AccessToken | null> { | |
return { | |
token: this.token, | |
expiresOnTimestamp: this.expiresOn | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment