File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
core/src/main/java/com/ibm/watson/developer_cloud/service/security Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -45,12 +45,13 @@ public class IamTokenManager {
4545 private static final String REFRESH_TOKEN = "refresh_token" ;
4646
4747 public IamTokenManager (IamOptions options ) {
48- if (CredentialUtils .hasBadStartOrEndChar (options .getApiKey ())) {
49- throw new IllegalArgumentException ("The IAM API key shouldn't start or end with curly brackets or quotes. "
50- + "Please remove any surrounding {, }, or \" characters." );
48+ if (options .getApiKey () != null ) {
49+ if (CredentialUtils .hasBadStartOrEndChar (options .getApiKey ())) {
50+ throw new IllegalArgumentException ("The IAM API key shouldn't start or end with curly brackets or quotes. "
51+ + "Please remove any surrounding {, }, or \" characters." );
52+ }
53+ this .apiKey = options .getApiKey ();
5154 }
52-
53- this .apiKey = options .getApiKey ();
5455 this .url = (options .getUrl () != null ) ? options .getUrl () : DEFAULT_IAM_URL ;
5556 this .userManagedAccessToken = options .getAccessToken ();
5657 tokenData = new IamToken ();
You can’t perform that action at this time.
0 commit comments