Get Unauthorized in Sandbox Here is the code ```...
# gooddata-cloud
d
Get Unauthorized in Sandbox Here is the code
Copy code
# Get declarative workspace
declarative_workspace = sdk_production.catalog_workspace.get_declarative_workspace(workspace_id="tenant-reporting-base")
sdk_sandbox.catalog_workspace.put_declarative_workspace(workspace_id="tenant-reporting-base-clone",workspace=declarative_workspace)
Error
Copy code
---------------------------------------------------------------------------
UnauthorizedException                     Traceback (most recent call last)
Cell In[26], line 1
----> 1 sdk_sandbox.catalog_workspace.put_declarative_workspace(workspace_id="tenant-reporting-base",workspace=declarative_workspace)

File ~/Library/Python/3.9/lib/python/site-packages/gooddata_sdk/catalog/workspace/service.py:342, in CatalogWorkspaceService.put_declarative_workspace(self, workspace_id, workspace, standalone_copy)
    340     workspace = copy.deepcopy(workspace)
    341     workspace.remove_wdf_refs()
--> 342 self._layout_api.put_workspace_layout(workspace_id, workspace.to_api())

File ~/Library/Python/3.9/lib/python/site-packages/gooddata_api_client/api/layout_api.py:3358, in LayoutApi.put_workspace_layout(self, workspace_id, declarative_workspace_model, **kwargs)
   3354 kwargs['workspace_id'] = \
   3355     workspace_id
   3356 kwargs['declarative_workspace_model'] = \
   3357     declarative_workspace_model
-> 3358 return self.put_workspace_layout_endpoint.call_with_http_info(**kwargs)

File ~/Library/Python/3.9/lib/python/site-packages/gooddata_api_client/api_client.py:880, in Endpoint.call_with_http_info(self, **kwargs)
    877             if content_types_list:
    878                 params['header']['Content-Type'] = content_types_list
--> 880 return self.api_client.call_api(
    881     self.settings['endpoint_path'], self.settings['http_method'],
    882     params['path'],
    883     params['query'],
    884     params['header'],
...
UnauthorizedException: Status Code: 401
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 26 Sep 2024 15:22:03 GMT', 'Content-Length': '9', 'Connection': 'keep-alive', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Content-Type-Options': 'nosniff', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains', 'X-XSS-Protection': '0', 'Referrer-Policy': 'no-referrer', 'set-cookie': 'SPRING_REDIRECT_URI=; Max-Age=0; Expires=Thu, 26 Sep 2024 15:22:03 GMT; Path=/; Secure; HTTPOnly; SameSite=None'})
HTTP response body: /appLogin
i
Hi Doug, Are you able to login with same credential to your Sandbox organization, please? Also, what authentication method do you usually use here, please?
d
i dont understand the question, my username and password for sandbox os different then production for production i use our secure login with gmail, with sandbox it's a username and password
i
Ah, sorry for my confusion here. I wrongly assumed that you are speaking about your DEV/TEST organization being accessed via Py SDK, but you are probably working with Python Sandbox or similar tool, correct? How exactly are you connecting to your GoodData instance, please? For Python SDK we usually use API token.
d
We have a gooddata sandbox and a gooddata produdtion Yes of course, I have that set up already. I don't want to share my API token for
sdk_production
or
sdk_sandbox
But it goes like its supposed to - I have successfully pulled the workspace but getting denied as you can see from the error on the put
Copy code
from gooddata_sdk import GoodDataSdk

host = {}
token = {}
sdk_sandbox = GoodDataSdk.create(host, token)
i
No need to share your API token here, I was just trying to find out how do you authenticate, since you are getting the "401" status. Thanks for the clarification, I will check internally what might be causing such behaviour.
Hi @Doug Creighton , Are you able to share with us some identifier of the failed PUT call, please? RequestID/TraceId or some ErrorId if possible?
d
I sent you the entire error your SDK returned
👍 1
It might be easier if you just run it yourself - Create your own token and write it to our sandbox - then you can get your own error
@Ivana Gasparekova any luck? I really would like to get this started
i
Hey Doug, Sorry for the radio silence here. I've passed your case to our SDK experts and one of our colleagues will get back to you shortly.
1
r
Heya Doug, Radek here 🙂 Since you're getting the unauthorized exception from the sandbox env, but the prod env is working, I'm just wondering if you've tried to test that the token for the sandbox is correct (by just trying to get something relatively straightforward like the list of workspaces or something).. just to make sure we're not overlooking anything!
g
hi @Radek Novacek kyle.lamoureux@laivly.com is also having issues logging into the sandbox environment. When clicking password reset, no email arrives. Would it be possible to send a link? Thank you
r
Hi Greta, I've requested a password reset on Kyle's behalf 👍
m
Hi Doug, as discussed in the internal ticket, we've sent a password to kyle.lamoureux@laivly.com.
🙌 1