Cofor.io can take care of user signup and setting up payments for your product!
For B2B only
This OAuth flow is only for products where users must be a part of a team. Teams have shared access to resources and use a single payment method.
Link the "Signup" button on your product frontend and/or marketing page to the following URL:
https://cofor.io/oauth/create?product={PRODUCT_ID}&redirect_uri={REDIRECT_URI}&state={STATE}
Use the following query parameters to send information to Cofor.io about your product and login flow:
- product: The product ID provided to you when setting up your product on Cofor.io
- redirect_uri: URL to send the user to after login or in case of error
- state: (Optional) Any information to be returned as is to the redirect URI
This will take the user to a Cofor.io login page. If they already have a Cofor.io account (maybe used on another product), they can use that to authenticate. If not, they will be given the option to create a new account.
In the Cofor.io product configuration page, if you choose to collect users' payment method and billing information upon creating the team, Cofor.io will collect that for you and set them up with your Stripe account. This means you don't have to touch sensitive credit card or bank account information!
Once their account is created, they will be sent to the redirect URL along with a team creation token in the URL query parameter token. For example, if the redirect URI is https://my.product.com/signup, then the user will be sent to:
https://my.product.com/signup?token={TEAM_CREATION_TOKEN}
Set up Redirect URIs on Cofor.io
Make sure you set up a list of acceptable Redirect URIs on the Cofor.io Product Configuration page! If not, Cofor.io will NOT redirect you back to the provided URIs on the flow query parameters.
Your product frontend can then collect any additional information needed from the user (such as plan, etc.) and then make a request to your product API to create the team. If you don't have any additional information to collect, you can also directly make the request on loading the product creation page.
On your product backend, make a request to the Product REST API to create your team, or use the Product SDK to create your team.
After your team has been created, you need to login the user. Since we know exactly who created the account, you can automatically log them in by passing the owner's team membership ID to an OAuth confirmation page:
https://cofor.io/oauth/confirm?product={PRODUCT_ID}&membership={MEMBERSHIP_ID}&user={USER_ID}&redirect_uri={REDIRECT_URI}&state={STATE}
Use the following query parameters to send information to Cofor.io about your product and login flow:
- product: The product ID provided to you when setting up your product on Cofor.io
- membership: The owner's team membership ID returned when the team is created
- user: The owner's user ID (this is needed to get cached authentication token)
- redirect_uri: URL to send the user to after login or in case of error
- state: (Optional) Any information to be returned as is to the redirect URI
Once the user confirms that they are attempting to login to the team they just created, the user authorization token will be send to the redirect URI as done in the login flow.
