I'm trying to integrate PayFast Payment Gateway (Custom) into my ReactJS and NodeJS App. In ReactJS App, I'm only creating "Checkout Form" and calling Sandbox URL with ID, Key, Notify URL, Return and Cancel URL. In NodeJS App, I'm creating a Endpoint (Webhook) where I expected to receive Transaction Webhook Payload but I didn't receive ITN Payload in req.body.
Anyone can help me ?
Note: I already using ngrok to access my localhost publicly with https.
Thanks
Already write the code according to documentation.
Related
I have a widget which users integrate on their website and the request from the widget comes to our nodeJS backend. I want to implement auth mechanism so that I will verify those requests and then only process it.
PS - JWT token will not be helpful as anyone can check network tab and send requests using Postman or any API client
I am building a webapp using nodeJS as the server-side framework and reactJS as the client-side framework.
My issue is the following:
I'm trying to create an account registration mechanism, which is working fine. I do receive an email with a specifc token in order to active an account. The issue that I am facing is that the API which will consume is on the nodeJS side, and I can't figure out how I can force a page to being rendered from the client side as a result of the success, since the API is located on the server on a different port?
Am I approaching this wrongly, and as such I am facing this specific issue?
It's simple you just handle it on both sides,
meaning that you send a verification link in the email so it redirects the user to your application and then on the client app extract the toke (the verification code needed on the verification link from the email) and send it to the server(API) depending on the request status you will take an action, if its verified successfully you will redirect the user to home (or to log in again, or it does not show an error message!
Since I'm new to API calls, I'm having issues regarding making API calls from backend. I've a form that takes AccessToken from the user. Based on the token received, I've to make an API call to 3rd party API. It should return the roles that the particular user has. The token has to be sent as headers.
How to make the API call if the Frontend is on ReactJs and Backend is running on NodeJs.
Basically you have three entities at work here.
Your Backend - Node
Your Client - React
External Service - Some other service where you are making the call from your backend
Assuming the flow of your application is like this:
Your Client -> (asks for some resource) Your Backend -> (requests an api from external service)
So you can expose an endpoint on Your Backend, which Your client will call and in turn Your Backend will call an External Service using a library like Axios or the inbuilt Fetch API. As soon as Your Backend gets a response from the External Service, you can send the received response to Your Client.
Hope it helps!
I'm using Dialogflow v2 in my Angular app for the client side and I have a requirement to send a custom http header (token) with the request to get it from the webhook for an intent. How can I send this custom header to the API?
The way I made it work was by sending an HttpClient request to my firebase function to verify the authentication and from there I used the Dialogflow node SDK to do the Dialogflow related tasks, handling the webhooks by myself, instead of attaching a function in the Dialogflow intent.
This gave me the flexibility to use whatever type of authentication, intent and request handling I want, so I don't have to worry about the limited 5 seconds per webhook request as well.
I'm trying to authenticate with a third party API using OAuth 2 via a NodeJS + Express REST api. We're doing this through a ReactJS webapp
The current flow is that we send a request to our Express API from the front-end with the Fetch API, with a username as parameter
This request builds an authUrl object containing a redirect_url and then responds with
return res.redirect(authUrl);
When we initiate this endpoint straight from the browser, we get redirected to the Third Party API, and after authenticating a user is successfully created.
But the problem lies when we try to send a request to this endpoint from the front-end.
We added CORS headers to our Express app so we can reach this endpoint, but it still gave us the following error:
Fetch API cannot load OUR ENDPOINT. Redirect from 'OUR ENDPOINT' to 'THIRD PARTY API' has been blocked by CORS policy: Request requires preflight, which is disallowed to follow cross-origin redirect.
When we just do a res.json(authUrl) instead of res.redirect(authUrl) we retrieve a proper response containing the URL. But redirecting doesn't seem to work.
We experimented a bit with different headers but can't seem to find a suitable solution.
So we were wondering does res.redirect() handle requests differently? Are we implementing the OAuth flow properly? Do we need specific headers?
Any help would be welcome!
Summary of our flow:
Browser receives request for front-end
User enters his name and clicks the signup button
Our Rest API receives the request and builds an authentication url
Rest API sends a response that redirects the browser to the authurl.
After successful authentication, third party sends a confirmation to the callback endpoint of our Rest API.
With the confirmation, the Rest API then sends another request to the third Party API.
Rest API sends a response back to ReactJS app with the token.