-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56aec45
commit 27cd0b0
Showing
1 changed file
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,9 @@ Or install it yourself as: | |
You can find your API credentials in the [Stytch Dashboard](https://stytch.com/dashboard/api-keys). | ||
|
||
This client library supports all Stytch's live products: | ||
|
||
### B2C | ||
|
||
- [x] [Email Magic Links](https://stytch.com/docs/api/send-by-email) | ||
- [x] [Embeddable Magic Links](https://stytch.com/docs/guides/magic-links/embeddable-magic-links/api) | ||
- [x] [OAuth logins](https://stytch.com/docs/guides/oauth/idp-overview) | ||
|
@@ -37,7 +40,18 @@ This client library supports all Stytch's live products: | |
- [x] [Crypto wallets](https://stytch.com/docs/guides/web3/api) | ||
- [x] [Passwords](https://stytch.com/docs/guides/passwords/api) | ||
|
||
### Example usage | ||
### B2B | ||
|
||
- [x] [Organizations](https://stytch.com/docs/b2b/api/organization-object) | ||
- [x] [Members](https://stytch.com/docs/b2b/api/member-object) | ||
- [x] [Email Magic Links](https://stytch.com/docs/b2b/api/send-login-signup-email) | ||
- [x] [OAuth logins](https://stytch.com/docs/b2b/api/oauth-google-start) | ||
- [x] [Session Management](https://stytch.com/docs/b2b/api/session-object) | ||
- [x] [Single-Sign On](https://stytch.com/docs/b2b/api/sso-authenticate-start) | ||
- [x] [Discovery](https://stytch.com/docs/b2b/api/discovered-organization-object) | ||
- [x] [Passwords](https://stytch.com/docs/b2b/api/passwords-authenticate) | ||
|
||
### Example B2C usage | ||
Create an API client: | ||
```ruby | ||
client = Stytch::Client.new( | ||
|
@@ -61,6 +75,41 @@ client.magic_links.authenticate( | |
) | ||
``` | ||
|
||
### Example B2B usage | ||
|
||
Create an API client: | ||
```ruby | ||
require 'stytch' | ||
|
||
client = StytchB2B::Client.new( | ||
project_id: "project-test-uuid", | ||
secret: "secret-test-uuid" | ||
) | ||
``` | ||
|
||
Create an organization | ||
|
||
```ruby | ||
resp = client.organizations.create( | ||
organization_name: 'Example Org Inc.', | ||
organization_slug: 'example-org' | ||
) | ||
|
||
puts resp | ||
``` | ||
|
||
Log the first user into the organization | ||
|
||
```ruby | ||
resp = client.magic_links.email.login_or_signup( | ||
organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931', | ||
email_address: '[email protected]' | ||
) | ||
|
||
puts resp | ||
``` | ||
|
||
|
||
## Handling Errors | ||
|
||
When possible the response will contain an `error_type` and an `error_message` that can be used to distinguish errors. | ||
|