Android Question okHttp - javax.net.ssl.SSLProtocolException SHA-256

MarcoRome

Expert
Licensed User
Longtime User
Hi all. Time ago i write time ago one library Paypal credit card, now seem that this library have a few problems with SSL, when i call:
B4X:
https://api.sandbox.paypal.com/v1/oauth2/token","grant_type=client_credentials")

find message i have this error:
javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
After i change this line code:
B4X:
Change hc.Initialize in HttpUtils2Service to hc.InitializeAcceptAll
as suggestion Erel HERE

Now i have this error:

Any idea ?
Thank you
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
You can install a provider with JavaObject. See the attached project.
With this code seem that work.
But now i have this message:

{"error":"invalid_client","error_description":"Client credentials are missing"}

Seem that dont see Credentials, as if lost this ( User and Password ).
The code is:

B4X:
job1.Username = client_id_app1
job1.Password = secret_app1
job1.PostString("https://api.sandbox.paypal.com/v1/oauth2/token","grant_type=client_credentials")
job1.GetRequest.SetHeader("Content-Type", "application/json")
job1.GetRequest.SetHeader("Accept-Language", "en_US")

This work in Android 5.0 ( without add ProviderInstaller ) but give me error up with Android 4.4.
I think we're almost, but something is missing, as if he lost the credentials.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Note that you should call GetRequest.SetContentType instead of SetHeader. It is probably not related to the credentials but your current code will not set the content type header.

B4X:
.....
job1.PostString("https://api.sandbox.paypal.com/v1/oauth2/token","grant_type=client_credentials")
job1.GetRequest.SetContentType("application/json")
'job1.GetRequest.SetHeader("Accept-Language", "en_US")

I have this error ( job.ErrorMessage ):
Unsupported Media Type

 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
You haven't set the Accept header.
Some error:

B4X:
job1.PostString("https://api.sandbox.paypal.com/v1/oauth2/token","grant_type=client_credentials")
job1.GetRequest.SetHeader("Accept-Language", "en_US")
job1.GetRequest.SetHeader("Accept","application/json")
job1.GetRequest.SetContentType("application/json")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…