Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Octorun JS Missing Enterprise Login Workaround #621

@StanleyGoldman

Description

@StanleyGoldman

Breakout of #617

As explained here, we need a specific status code to indicate that an enterprise user should utilize their password as a token.

bool EnterpriseWorkaround(UriString hostAddress, Exception e)
{
// Older Enterprise hosts either don't have the API end-point to PUT an authorization, or they
// return 422 because they haven't white-listed our client ID. In that case, we just ignore
// the failure, using basic authentication (with username and password) instead of trying
// to get an authorization token.
var apiException = e as ApiException;
return !HostAddress.IsGitHubDotCom(hostAddress) &&
(e is NotFoundException ||
e is ForbiddenException ||
apiException?.StatusCode == (HttpStatusCode)422);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions