#lalarukh.
1 messages · Page 1 of 1 (latest)
You mean this step, right? https://stripe.com/docs/connect/oauth-standard-accounts#token-request
Absolutely. I'm following the same and almost reached the point#4.
Can you show me a small snippet of the code that's making the request?
Sure!
Deleted that message since it had your secret key in it
Please don't post screenshots with your secret key in them
👍 and is this node? What framework ar you using/how have you set up your route?
What's the error you get when you use await?
Using Await.
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?
I took the code for sending to server from here:
https://stripe.com/docs/connect/oauth-standard-accounts#token-request
Yes but I want more details about how/where you've implemented your code
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.
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
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).
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?
Kindly give this a look. In this I'm denying the connection and in redirect_uri I'm getting this response, which is correct: http://localhost:3000/admin/settings?error=access_denied&error_description=The+user+denied+your+request
Hi there. Give me a bit to catch up here. Karbi had to step out
Sure, please. Thanks!
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
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'); }
That code doesn't call your server...
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
Ok I'm a bit confused then. So you redirect to your redirect_uri. But when does the server-side code that calls POST https://connect.stripe.com/oauth/token get called?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Are you attempting to make that client-side?
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.
That I understand. What I don't understand is what triggers your server-side code to call POST https://connect.stripe.com/oauth/token
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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
This is the client-side code I'm currently using.
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
Then how can I get the user_stripe_id and store in my DB?
This is the step I'm currently in: https://stripe.com/docs/connect/oauth-standard-accounts#token-request
You need to do that on your server. So,
- Once redirected to your redirect_uri, fire a request to YOUR server.
- 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
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Thanks for providing, checking it.
Basically all of step 4: https://stripe.com/docs/connect/oauth-standard-accounts#token-request needs to happen on your server
And I can't stress this enough, never expose your secret key client-side
Only publishable key should ever be used client-side
I totally got it. Thanks for informing.