Stripe Connect redirect uri issue for multitenant application

Viewed 290

I am following the steps in Stripe connect oaunth. Everything worked fine till there was issue on redirecting after the auth as my application is Multitenant(with multiple subdomains). We can pass a param called redirect_uri which should exactly match one of the redirect_uris that we have already added in our stripe account's platform settings.

https://connect.stripe.com/oauth/authorize?response_type=code&client_id=<my_client_id>&scope=read_write&redirect_uri=https://subdomain.staging.domain.com

Here comes the issue that the call to stripe will be made from one of the subdomains and it is not practical to enter each and every subdomains as there are plenty of them and it has potential to grow in number as well.

Any possible solutions?

1 Answers

The workaround on this was having the state param which stripe returns to the redirect URI we specifies.

I have sent the subdomain name as the state param. Then from stripe redirected to a controller action(this url was given as the redirect URI) where there was no authentication required. From this controller action, using the returned state param, the url to the required method(with subdomain in the url) was created and redirected. This served my need!

Related