The current implementation of asynchronous token functions (getTokensAuthorizationCodeGrant, getTokensRefreshGrant, getEnterpriseAppAuthTokens, getAppUserTokens, revokeTokens) can handle both callbacks and promises.
However, in the TypeScript definition, the callback function is not marked as optional, meaning these functions have to be called with an empty function:
// this errors:
const tokenInfo = await getTokensRefreshGrant(refreshToken, null);
// this is fine:
const tokenInfo2 = await getTokensRefreshGrant(refreshToken, null, () => {});
This looks confusing, and is also inefficient as it creates a function in memory for no reason. Could we make them optional? Happy to open a PR if that helps.
Additionally, it could also be nice for these same functions to make options optional as well, instead of having to specify null
The current implementation of asynchronous token functions (
getTokensAuthorizationCodeGrant
,getTokensRefreshGrant
,getEnterpriseAppAuthTokens
,getAppUserTokens
,revokeTokens
) can handle both callbacks and promises.However, in the TypeScript definition, the callback function is not marked as optional, meaning these functions have to be called with an empty function:
This looks confusing, and is also inefficient as it creates a function in memory for no reason. Could we make them optional? Happy to open a PR if that helps.
Additionally, it could also be nice for these same functions to make
options
optional as well, instead of having to specifynull