Skip to content

Commit

Permalink
check for token (#14959)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusongit authored Feb 22, 2024
1 parent 4e97151 commit 051b380
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,12 @@ private MLNodeAutoCompletionResponse GetMLNodeAutocompleteResults(string request
var uri = DynamoUtilities.PathHelper.GetServiceBackendAddress(this, nodeAutocompleteMLEndpoint);
var client = new RestClient(uri);
var request = new RestRequest(string.Empty,Method.Post);

request.AddHeader("Authorization",$"Bearer {tokenprovider?.GetAccessToken()}");
var tkn = tokenprovider?.GetAccessToken();
if (string.IsNullOrEmpty(tkn))
{
throw new Exception("Authentication required.");
}
request.AddHeader("Authorization",$"Bearer {tkn}");
request = request.AddJsonBody(requestJSON);
request.RequestFormat = DataFormat.Json;
RestResponse response = client.Execute(request);
Expand Down

0 comments on commit 051b380

Please sign in to comment.