401 Error connecting to server from Python REST API
I have a friendship link in our ETM with another cloud server's RM project. The link can connect test cases with the requirements. It is working as of now in our ETM.
I am trying to use Python REST API to get the data from either server with also the link. I am having troubles connecting to the server as I'm not sure which authentication needed. I'm not familiar with REST API and keep getting the 401 error. I have used different authentication types including basic, form, oscl, and bearer but all returns the same 401 response. I have read from several forums, jazz.net and also tried to use it in my code but it still gives the 401 error.
When I try to get the "WWW-Authenticate" header it returns a jauth realm link and token_uri link. I'm not sure what to do with it and what it means.
Any help or tips are greatly appreciated!
Thanks in advance!
|
One answer
Ralph Schoon (63.5k●3●36●46)
| answered Jun 23 '22, 1:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER As far as I can tell, the friendship link does not solve the login problem. It might play a role in OAuth authentication. I have played with OAuth, but with limited success, because it seems to still require the user to authenticate.
I have created https://rsjazz.wordpress.com/2021/10/15/elm-authentication/ to explain my experiences with ELM Authentication. It explains all the different options (as far as I was able to figure them out) of the dance. The blog also has a link to some more information regarding OAuth.
The authentication code I use is not fully published. You might be able to steal something from
PyPI ELM Client – Python client with examples by Ian Barnard.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
The 401 implies an authorization issue. As Ralph comments below the OAuth1.0a dance will use the information in the friendship but it is not just dependent on friend ship. I have provided both a 1.0a and a OIDC (Oauth2.0) bearer token blog post at - - https://michaelrowe01.com/index.php/day-job/ibm-elm/api-authentication-method-in-elm-oauth-1-0a/ and https://michaelrowe01.com/index.php/day-job/ibm-elm/api-authentication-method-in-elm-oidc/ . These posts also provide sample Postman files for testing it out the process.. I hope it helps.