Skip to main content
edited title
Link
Quick learner
  • 11.6k
  • 4
  • 52
  • 61

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

added 429 characters in body
Source Link
Markus
  • 727
  • 3
  • 11
  • 26

I'm trying to connect to either of these places and get the JSON data:-

https://content.guardianapis.com/search?q=debate&tag=politics/politics&from-date=2014-01-01&api-key=test https://content.guardianapis.com/search?q=debates&api-key=test https://content.guardianapis.com/search?api-key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx 

All three I can get to via the browser, but when I try to access them via an android app I get the following errors:-

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400 

I've added this to manifest.xml:-

<uses-permission android:name="android.permission.INTERNET"/> 

I also added this to the manifest.xml:-

android:networkSecurityConfig="@xml/network_security_config" 

And created res/xml/network_security_config.xml, which contains:-

<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">content.guardianapis.com</domain>> </domain-config> 

Which changes the error to:-

D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true Error response code: 400 

I know it's missing:-

<trust-anchors> <certificates src="@raw/my_ca"/> </trust-anchors> 

but I have no idea where or what the certificate would be or if it's needed.

Not really sure what is going on, any help would be appreciated.

IN ADDITION:- I am able to connect fine and get the JSON from this URL:-

https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&eventtype=earthquake&orderby=time&minmag=6&limit=10 

All I get is this:-

No Network Security Config specified, using platform default 

Buy not error 400 and gets through with a 200 instead. So it makes me think there is something weird going on, but not sure where.

I'm trying to connect to either of these places and get the JSON data:-

https://content.guardianapis.com/search?q=debate&tag=politics/politics&from-date=2014-01-01&api-key=test https://content.guardianapis.com/search?q=debates&api-key=test https://content.guardianapis.com/search?api-key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx 

All three I can get to via the browser, but when I try to access them via an android app I get the following errors:-

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400 

I've added this to manifest.xml:-

<uses-permission android:name="android.permission.INTERNET"/> 

I also added this to the manifest.xml:-

android:networkSecurityConfig="@xml/network_security_config" 

And created res/xml/network_security_config.xml, which contains:-

<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">content.guardianapis.com</domain>> </domain-config> 

Which changes the error to:-

D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true Error response code: 400 

I know it's missing:-

<trust-anchors> <certificates src="@raw/my_ca"/> </trust-anchors> 

but I have no idea where or what the certificate would be or if it's needed.

Not really sure what is going on, any help would be appreciated.

I'm trying to connect to either of these places and get the JSON data:-

https://content.guardianapis.com/search?q=debate&tag=politics/politics&from-date=2014-01-01&api-key=test https://content.guardianapis.com/search?q=debates&api-key=test https://content.guardianapis.com/search?api-key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx 

All three I can get to via the browser, but when I try to access them via an android app I get the following errors:-

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400 

I've added this to manifest.xml:-

<uses-permission android:name="android.permission.INTERNET"/> 

I also added this to the manifest.xml:-

android:networkSecurityConfig="@xml/network_security_config" 

And created res/xml/network_security_config.xml, which contains:-

<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">content.guardianapis.com</domain>> </domain-config> 

Which changes the error to:-

D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true Error response code: 400 

I know it's missing:-

<trust-anchors> <certificates src="@raw/my_ca"/> </trust-anchors> 

but I have no idea where or what the certificate would be or if it's needed.

Not really sure what is going on, any help would be appreciated.

IN ADDITION:- I am able to connect fine and get the JSON from this URL:-

https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&eventtype=earthquake&orderby=time&minmag=6&limit=10 

All I get is this:-

No Network Security Config specified, using platform default 

Buy not error 400 and gets through with a 200 instead. So it makes me think there is something weird going on, but not sure where.

Source Link
Markus
  • 727
  • 3
  • 11
  • 26

NetworkSecurityConfig: No Network Security Config specified, using platform default

I'm trying to connect to either of these places and get the JSON data:-

https://content.guardianapis.com/search?q=debate&tag=politics/politics&from-date=2014-01-01&api-key=test https://content.guardianapis.com/search?q=debates&api-key=test https://content.guardianapis.com/search?api-key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx 

All three I can get to via the browser, but when I try to access them via an android app I get the following errors:-

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400 

I've added this to manifest.xml:-

<uses-permission android:name="android.permission.INTERNET"/> 

I also added this to the manifest.xml:-

android:networkSecurityConfig="@xml/network_security_config" 

And created res/xml/network_security_config.xml, which contains:-

<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">content.guardianapis.com</domain>> </domain-config> 

Which changes the error to:-

D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true Error response code: 400 

I know it's missing:-

<trust-anchors> <certificates src="@raw/my_ca"/> </trust-anchors> 

but I have no idea where or what the certificate would be or if it's needed.

Not really sure what is going on, any help would be appreciated.