Hello I am a beginner in mobile app development. I am doing project in react native.In my app I need to fetch the food details from foodb website using API. I tried in postman to get response but I am getting error.
Error:
{
"error": "food_name is missing, api_key is missing"
}
Kindly guide me to resolve this problem. Thanks in Advance
You have to add parameter as query parameters:
curl -X GET 'https://foodb.ca/api/v1/foodreport/food?food_name=Angelicaa&api_key=d9b6cec3eb561db6f920a0797ba49f3e'
Related
I'm trying to connect to the Twinfield API. I have registered an app in the developer portal, and created a callback URI. My call looks as follows:
https://login.twinfield.com/auth/authentication/connect/authorize?redirect_uri=https://oauth.pstmn.io/v1/callback&response_type=id_token+token&client_id=###&client_secret=#####
Link to twinfield api documentation
However I get the error stating that the client application is not known or is not authorized.
Can someone help me with this problem?
Think you are missing the code, see below the response_type
&response_type=code&scope=openid+twf.user+twf.organisation+twf.organisationUser+offline_access&redirect_uri=https://oauth.pstmn.io/v1/callback&
Once you've run this, you get a code and together with basic64encoding of your client_id:client_secret would profide you an access code.
The whole request should look like:
https://login.twinfield.com/auth/authentication/connect/authorize?client_id={xxxx}&response_type=code&scope=openid+twf.user+twf.organisation+twf.organisationUser+offline_access&redirect_uri=https://oauth.pstmn.io/v1/callback&state=SOME_RANDOM_STATE&nonce=SOME_RANDOM_NONCE
for me to get this working in postman I need to copy the whole link into the browser, login there and then get from the return link the code when you see the page "Your call is authenticated"
I am using fetch function in React Native to call ASP.NET web API to get list of data in a JSON format. The response which I am getting from API is 200 (ok). But I am not getting the actual data. If I ran the same URL in Postman I am getting the data which I am expecting.
For example, I am running http://192.168.1.5:8082/api/ECommerce/GetCategory URL in GET method. If I am running the above URL in Postman I am getting the data which I expected.
If I am using the same URL in fetch function in React Native and console the response now I am getting the following:
I am not getting the list of data.
I am trying to get the API on the react-native interface by calling with Axios but getting a network error. My API is written in .net core version 3.0.
I have successfully tried postman but failed to call
Please help me fix it.enter image description here
enter image description here
You can passing header in your axios request to fix CORS as Ketan Rampteke's reply.
Follow link .
Chào thân ái người anh em <3
Im trying to add google authentication for my application which built with laravel 5.5 with Laravel Socialite. So for that I have created a google developer account via google developer console and enabled google+ api.
So when I try to register when it redirect to call back url it gives me below error. I have gone through lot of documentations and stackoverflow questions almost. But no luck.
This is the error
GuzzleHttp \ Exception \ ClientException (403)
Client error: `GET https://www.googleapis.com/plus/v1/people/me?prettyPrint=false` resulted in a `403 Forbidden` response: { "error": { "code": 403, "message": "Legacy People API has not been used in project
Could anyone please help me on this
Thanks
use Socialite::with('Google')->user();
it was help me
Developing sample application, when i was call the post method
service in componentDidMount() getting error response access
denied. Only android it's having this issue. But I got this
response IOS Devices .
I researched this case Most of the this issue get an based up on
NetWork same wife connection like emulator and my System this is
fine.
when i was check on AndroidManifest.xml file also getting
Internet Permissions also Accessed.But Still getting this Error in
Android. Please Solve this ,
Only getting in Android Device and emulator having this issue
other Platform device like IOS working fine.
Thanks in Advance.
If the REST server is on localhost in Android you'll have to use your IP instead of http://localhost.
If the rest server is not on localhost you might have to adjust the body and the headers. So instead of string body use a json object etc.
Your code:
fetch('site:ab4aca652284d7dc87ca1f347f2ac432#ori-eu-west-1.searchly.co…
',{ method:'POST', headers:{ 'Accept':'application/json',
'Content-Type':'application/json' }, body:JSON.stringify(string)
}).then((response)=>response.json()).then((responseData)=>{
}).catch((err)=>{ console.error(err) })
rowDatanewOrders:{"status":"error","message":"access denied"}
make sure you have a valid json in body if you have the header 'Content-Type':'application/json', not a string as you have now!
more details about possible adjustments of the body and headers here:
https://github.com/facebook/react-native/issues/5222