kennethormandy / craft-marketplace

Make your Craft Commerce site a Marketplace, via Stripe
https://plugins.craftcms.com/marketplace
Other
7 stars 0 forks source link

Confusing redirect after OAuth flow #6

Closed kennethormandy closed 4 years ago

kennethormandy commented 4 years ago

Successfully completing the Stripe OAuth flow redirects you to /admin/oauthclient/apps, when it should probably send you to your user profile for our use case right now.

I personally would want /admin/myaccount#profile-tab-platform because I configured the Connect button to live on the user profile tab, but in theory the CMS owner might not have put it there. So the redirect should be the page you started from, or a configurable setting that gets passed along to Stripe (ex. you might want it to be a page that tells your payees what to do next).

kennethormandy commented 4 years ago

This is supported when you submit a POST request, but not when you link to the URL. I can only link to the URL, because the view where the fields are added on the User page is already inside a form. You can’t have a form inside a form, it just submits the parent form, which is why it just keeps saving the user. The hook on the user page also isn’t helpful, because that’s in the form too. And, the button is intentionally a Craft from field, because we save the Stripe account ID there.

This PR adds support for a feature I could use, with some other possible options: https://github.com/venveo/craft-oauthclient/pull/29