Skip to content

Commit

Permalink
fix(service-client): Fixing the required format for sending aad token…
Browse files Browse the repository at this point in the history
…s to the service (#1834)
  • Loading branch information
vinagesh authored Mar 18, 2021
1 parent a061750 commit 9c5a118
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iothub/service/src/IotHubTokenCredentialProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class IotHubTokenCrendentialProperties
: IotHubConnectionProperties
{
#if !NET451
private const string _tokenType = "jwt";
private const string _tokenType = "Bearer";
private readonly TokenCredential _credential;
private readonly object _tokenLock = new object();
private AccessToken? _cachedAccessToken;
Expand Down Expand Up @@ -63,7 +63,7 @@ public override string GetAuthorizationHeader()
}
}

return $"Bearer {_cachedAccessToken.Value.Token}";
return $"{_tokenType} {_cachedAccessToken.Value.Token}";

#endif
}
Expand All @@ -82,7 +82,7 @@ public async override Task<CbsToken> GetTokenAsync(Uri namespaceAddress, string
new TokenRequestContext(CommonConstants.IotHubAadTokenScopes),
new CancellationToken()).ConfigureAwait(false);
return new CbsToken(
token.Token,
$"{_tokenType} {token.Token}",
_tokenType,
token.ExpiresOn.UtcDateTime);
#endif
Expand Down

0 comments on commit 9c5a118

Please sign in to comment.