Skip to content

Commit 0386527

Browse files
committed
feat(credentials): If the password begins with 'icp-' authenticate using basicauth instead of doing token exchange
1 parent 1864798 commit 0386527

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/IBM.WatsonDeveloperCloud/Service/WatsonService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace IBM.WatsonDeveloperCloud.Service
2424
public abstract class WatsonService : IWatsonService
2525
{
2626
const string PATH_AUTHORIZATION_V1_TOKEN = "/authorization/api/v1/token";
27-
27+
const string ICP_PREFIX = "icp-";
2828
public IClient Client { get; set; }
2929

3030
public string ServiceName { get; set; }
@@ -89,7 +89,7 @@ protected WatsonService(string serviceName, string url, IClient httpClient)
8989
/// <param name="password">The password</param>
9090
public void SetCredential(string userName, string password)
9191
{
92-
if (userName == "apikey")
92+
if (userName == "apikey" && !password.StartsWith(ICP_PREFIX))
9393
{
9494
TokenOptions tokenOptions = new TokenOptions()
9595
{

0 commit comments

Comments
 (0)