#lalarukh.

1 messages · Page 1 of 1 (latest)

pine snowBOT
agile rover
fickle mortar
#

Absolutely. I'm following the same and almost reached the point#4.

agile rover
#

Can you show me a small snippet of the code that's making the request?

fickle mortar
#

Sure!

agile rover
#

Deleted that message since it had your secret key in it

#

Please don't post screenshots with your secret key in them

fickle mortar
#

Sorry!

agile rover
#

👍 and is this node? What framework ar you using/how have you set up your route?

fickle mortar
#

Yes this is nodeJS.

#

Another code using Await.

agile rover
#

What's the error you get when you use await?

fickle mortar
#

Using Await.

agile rover
#

Can you give me some more detail about how that code you've shared is being triggered? Is this a server endpoint that you're calling client-side? How is your endpoint configured?

pine snowBOT
fickle mortar
agile rover
#

Yes but I want more details about how/where you've implemented your code

fickle mortar
#

I'm a full stack developer, I coded to by myself to send the request to the server.

Sorry. I am probably missing the main narrative of question, can you please ellaborate a bit more.

agile rover
#

I just want more details about how you've configured your endpoint route and what the redirect_uri endpoint overall is doing. In your error screenshot I see it seemingly reference pieces of your client-side coe (like AccountSetting.js) and (RequestSender.js) and I'd like more detail aon what those do and how they git intoyour integration overall

fickle mortar
#

AccountSetting.js is the page which i have added on redirect_uri in connect page of Stripe dashboard.
In redirect_uri I have wrote http://localhost:3000/admin/settings
And after connecting or denying the user stripe its genuinely redirecting back to this URL.

Now till gettting back authorization_code with redirect_uri everything is working absolutely fine.

I'm falling off is step#4 where I'm using POST method to get the user_stripe_id from response. But I can't send the server my authorization_code because of these errors(in screenshot).

agile rover
#

Just to be clear - your code that's making the request to stripe w/ the auth_code is on your own server right?

#

Can you show us how you're calling to your own server once you get the auth code from stripe after beign redirected?

fickle mortar
void island
#

Hi there. Give me a bit to catch up here. Karbi had to step out

fickle mortar
#

Sure, please. Thanks!

void island
#

We still need this to look further:
Can you show us how you're calling to your own server once you get the auth code from stripe after beign redirected?
Like we need you to share the client side code that does this

fickle mortar
#

The redirect_uri has the authorization_code or error so I'm getting this way:

const queryString = window.location.search const urlParams = new URLSearchParams(queryString) if (urlParams.has('code')) { const authcode = urlParams.get('code'); }

void island
#

That code doesn't call your server...

fickle mortar
#

I'm not using any code for redirecting back to my server.
I have added my project URL in OAuth test -> redirect_uri
That's how its automatically calling my server after proceeding this stripe and getting authorization code.

#

Getting Network error actually

void island
#

Are you attempting to make that client-side?

fickle mortar
#

Wait let me ellaborate more.

My platform has multiple merchant who can connect their stripe payment method and can get paid by there customers through our platform.

Now, where I'm lying is to connect the stripe of our merchant in my platform.
Now, whats going on I'm able to
1- client_id request to stripe server to get authorization_code of user.
2- getting authorization_code in redirect_uri from stripe panel

Error:
Now through this authorization_code I've gotten in my URL as redirect_uri
I want to get the user_stripe_id using this authorization_code by sending request to stripe server.
I'm using NodeJS framework but my code is getting error in sending request to stripe server, stripe server is not accepting the request. However the code method is correct, probably I'm missing a point.
Would like to just send the authorization_code to stripe server and get user_stripe_id in nodeJS, that's it.

void island
#

Once you're redirected to redirect_uri, do you fire a fetch request to your server?

#

Really would help if you send me code

#

More of the client side code

fickle mortar
void island
#

Oh

#

That's the problem

#

You can't make that call client side

#

Needs to be server side

#

You should never use your secret key in client side calls

fickle mortar
#

Then how can I get the user_stripe_id and store in my DB?

void island
#

You need to do that on your server. So,

  1. Once redirected to your redirect_uri, fire a request to YOUR server.
  2. In that endpoint on your server, make the call to POST https://connect.stripe.com/oauth/token to get user_stripe_id and return that from YOUR server endpoint back to your client-side
fickle mortar
#

Thanks for providing, checking it.

void island
#

And I can't stress this enough, never expose your secret key client-side

#

Only publishable key should ever be used client-side

fickle mortar
#

I totally got it. Thanks for informing.