Hi
We are trying to add OAuth Authentication in our Application, in my machine where the initial code was developed the authentication works fine, however when I share the code/Exe with team members in their machine it is not working, the first part to get Auth Code is working, but with this code to get the Token is not working.
When we try to mimic the same in Postman we are getting error: Self signed certificate in certificate chain
Tried with both HTTP client and Oauth Client.
We are using Authorization Code with PIKCE
PB Version: 2022R3.
Could anyone please help on this issue? What could be the issue, as it is working for me and not for him. TIA
Code Snippet:
//PostData
ls_PostData = "grant_type=authorization_code&client_id=" + ls_id + "&redirect_uri=" + ls_Redirect +"&scope=" + ls_Scope + "&code_verifier=" + ls_code_verifier + "&code="+ls_code
ll_return = lhc_Client.SendRequest( "POST", ls_Url, ls_PostData )
If ll_return = 1 And lhc_Client.GetResponsestatusCode() = 200 Then
lhc_Client.GetResponseBody ( ls_body )
ls_Error = ljpg_json.loadString ( ls_body )
If ls_Error = "" then
ls_TokenType = ljpg_json.GetValue("token_type")
ls_Token = ljpg_json.GetValue("access_token")
tab_1.Tabpage_2.token_type2.Text = ls_TokenType
tab_1.Tabpage_2.access_token2.Text = ls_Token
ls_AccessToken = ls_TokenType + " " + ls_Token
//Step 2: Get the RESTful server resource.
ls_Url = "https://xxxxxxxxxxxxxxxxxxxxxxxxx"
lhc_Client.ClearRequestHeaders()
lhc_Client.SetRequestHeader( "Authorization", ls_AccessToken )
ll_return = lhc_Client.SendRequest( "GET", ls_Url )
If ll_return = 1 And lhc_Client.GetResponsestatusCode() = 200 Then
lhc_Client.GetResponseBody ( ls_body )
mle_1.Text = ls_body
Else
mle_1.Text = "ResourceResponse Falied: "+ "Return :" + String ( ll_return ) + "~r~n" + lhc_Client.GetResponsestatusText()
End If
Else
mle_1.Text = "Error: "+ ls_Error
End If
Else
mle_1.Text = "AccessToken Falied: "+ "Return :" + String ( ll_return ) + "~r~n" + lhc_Client.GetResponsestatusText()
End If
The few other machines where we tried we did not get any such popup or message to import certificate, we just ran the exe and it worked fine.
Also we did not get any certificate from server to install. Is there any option in PowerBuilder to do this via code?
Via PB code both with the setting turned on and off we are getting the same -1 return code.
Does anyone knows what could be the issue at system level? please guide.