You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently wanted to add NGitLab to my project but ran into an issue where the GitLabCredentials constructor enforces a mandatory API token:
public GitLabCredentials(string hostUrl, string apiToken)
{
if (string.IsNullOrEmpty(hostUrl))
throw new ArgumentException("HostUrl is mandatory", nameof(hostUrl));
if (string.IsNullOrEmpty(apiToken))
throw new ArgumentException("Token is mandatory", nameof(apiToken));
ValidateHostUrl(hostUrl);
HostUrl = GetApiUrl(hostUrl);
_apiToken = apiToken;
}
However, looking at this condition in HttpRequestor.GitLabRequest.cs, it seems that requests without a token are actually supported: GitLabRequest.cs#L51
Is this an oversight, or is the token intentionally required in GitLabCredentials? If requests can be made without a token, would it make sense to allow GitLabCredentials to accept a null or empty token?
The text was updated successfully, but these errors were encountered:
Hello,
It's probably some code put in place a long time ago. As most API request requires to be authenticated, maybe it has just been made to correlate that.
Though, it's technically valid that you would want to do some requests without authentication and the option should be available.
If you want, you can contribute to the project and make a pull request to add it. Otherwise, we will try to make the change as soon as we can.
I recently wanted to add
NGitLab
to my project but ran into an issue where theGitLabCredentials
constructor enforces a mandatory API token:However, looking at this condition in
HttpRequestor.GitLabRequest.cs
, it seems that requests without a token are actually supported:GitLabRequest.cs#L51
Is this an oversight, or is the token intentionally required in
GitLabCredentials
? If requests can be made without a token, would it make sense to allowGitLabCredentials
to accept a null or empty token?The text was updated successfully, but these errors were encountered: