Class: GitHubAuth

GitHubAuth~ GitHubAuth


new GitHubAuth(env, environ, configFile, configExists)

Parameters:
Name Type Description
env Object

The environment object

environ Object

The environmentals object

configFile String

The configuration file path

configExists Boolean

Whether the configuration file exists

Source:

Methods


<async> checkTokenExpiration(token)

Checks if a GitHub token is valid and not expired

Parameters:
Name Type Description
token String

The GitHub token to check

Source:
Returns:

[isValid, statusObject, userData]

Type
Array

<async> getAccessTokenDeviceFlow()

Gets an access token using the GitHub device flow

Source:
Returns:

The access token object

Type
Object

getAccessTokenFromConfig()

Gets the access token from the configuration file

Source:
Returns:

The access token or null if not found

Type
String | null

getAuthTypeFromConfig()

Gets the authentication type from the configuration file

Source:
Returns:

The authentication type or null if not found

Type
String | null

<private> getFromConfig(section, option)

Gets a value from the configuration file

Parameters:
Name Type Description
section String

The section name in the config file

option String

The option name in the section

Source:
Returns:

The value or null if not found

Type
String | null

<async> verifyAccessToken(saveToConfig)

Verifies if the access token is valid and gets a new one if needed

Parameters:
Name Type Default Description
saveToConfig Boolean true

Whether to save to the configuration file, default is true

Source:
Returns:

[success, statusObject, tokenData]

Type
Array

verifyGitHubSection()

Verifies if the GitHub section exists in the configuration

Source:
Returns:

True if the GitHub section exists, otherwise false

Type
Boolean