0

I can’t create APIClient for watson openscale. I get message:

AuthorizationError: You are not authorized to access AI OpenScale instance ***

I am following the notebook below and stopped at ‘Configure OpenScale’ part:

https://github.com/IBM/watson-openscale-samples/blob/main/IBM%20Cloud/WML/notebooks/binary/spark/Watson%20OpenScale%20and%20Watson%20ML%20Engine.ipynb

I am failing on :

wos_client = APIClient(service_url='https://api.aiopenscale.cloud.ibm.com', service_instance_id='***', authenticator=IAMAuthenticator(apikey=CLOUD_API_KEY))

Will be grateful for any help

ertogrul
  • 23
  • 1
  • 8
  • And that's where you put in your API key? Please add details to your question.What API key are you using? If it is a variable, did you set it? – data_henrik Nov 26 '21 at 06:50
  • @data_henrik - yes, I set api key as CLOUD_API_KEY variable. It's a standard ibm cloud api key generated in manage -> IAM -> API keys -> Create an IBM API key. This key works just fine in the same code, few lines above, on other cloud service Watson MAchine Learning. – ertogrul Nov 26 '21 at 11:43
  • Why is your code about for APIClient different to the one in the linked notebook? Have you tried it like in the notebook, create the authenticator, then pass it? – data_henrik Nov 26 '21 at 13:45
  • Sure, I tried the original code and it did not work. Sorry, I should have put the original line into the question. – ertogrul Nov 26 '21 at 15:41

1 Answers1

1

data_henrik, thanks for your investigation.

It turned out the default code works fine for Watson OpenScale sitting in Dallas region of IBM Cloud. For my instance of WOS sitting in Frankfurt, I had wrong service_url and missing url parameter. The proper configuration is following:

authenticator = IAMAuthenticator(apikey=CLOUD_API_KEY, url = "https://iam.cloud.ibm.com/identity/token")
wos_client = APIClient(authenticator=authenticator, service_instance_id = "*****", 
service_url="https://eu-de.api.aiopenscale.cloud.ibm.com")

I have refreshed authenticator url, the old one stopped working.

ertogrul
  • 23
  • 1
  • 8