JSON Data API Action Not Working

Hello!

I have been playing around with the JSON Data and I know it comes down to not inputting this correctly as I am able to get it working correctly in Postman. I have checked out quite a few posts on this forum, the most relevant I believe is this one - but I still can’t quite figure it out:

If someone could help me re-create the postman request in Wappler I would be forever grateful!

Postman Code:

curl --location --request POST ‘https://api.backendless.com/B74598CC-00CA-43EA-FF12-731739342600/9AE65D67-0245-47D6-BD08-945389F18542/users/social/oauth/twitter/request_url
–header ‘application-type: REST’
–header ‘Content-Type: application/json’
–header ‘Accept-Language: en-us’
–header ‘Content-Type: text/plain’
–data-raw ‘{“fieldsMapping”:{“userId”:“twitterUserIdInBackendless”, “screenName”:“twitterScreenNameInBackendless”}, “redirect”:true}’

Screenshot of Wappler:

Screenshot of Browser Output:

Expected Output from Postman:

In Postman I am able to select the raw data type and I believe that might have something to do with it. I am sending the data in the wrong format and I’m just unsure how to put it in the correct form. Alternatively, I have everything right here but the local WAMP server is not able to handle this request. Those are the two scenarios I see.

@teodor, I’m hoping this is a simple fix and I’m just missing something, if so please let me know!

Thanks for any help in advance!

1 Like

@patrick @George Would either of you happen to have any ideas on this. I spent another evening playing around but I got nowhere.

Thanks for any help, if you can spare it!

HI Kasey,

You are trying to access twitter API without the proper authorization, so Twitter keeps on redirecting you to the login page.

In Postman this works because they do the oauth2 authorization for you.

In server connect you should do it your self in a step before the api call.

Maybe check Using OAuth2 Connector with Facebook which uses similar flow.

Hi @George ,

Thanks for the suggestion I will look into it! I didn’t think I would have to do that as the API call is actually to Backendless (which is a MBaaS that I use for authentication management). My understanding was that in using the Backendless framework, with everything set up properly, Backendless handles all that stuff. So in postman I am not actually using the oauth2 framework - I’m just calling the Backendless API which does all of that.

Is this something that I should discuss with their team? Sorry, I thought this was a Wappler issue, but maybe it’s not. I just thought it was weird I got it to work using Postman but not Wappler.

even with backend only - you need to do server side authentication. This is a so called client credential authentication:

image

It is good to undersatnd all the various oauth2 workflows, see:

https://oauth.net/2/

Thanks, @George! I appreciate the help, I’ll dive into oauth a bit more.