Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Discovery *b2b.DiscoveryClient M2M *consumer.M2MClient MagicLinks *b2b.MagicLinksClient OAuth *b2b.OAuthClient OTPs *b2b.OTPsClient Organizations *b2b.OrganizationsClient Passwords *b2b.PasswordsClient Project *consumer.ProjectClient RBAC *b2b.RBACClient RecoveryCodes *b2b.RecoveryCodesClient SCIM *b2b.SCIMClient SSO *b2b.SSOClient Sessions *b2b.SessionsClient TOTPs *b2b.TOTPsClient // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a Stytch API client that uses the provided credentials.
It detects the environment from the given projectID. You are still free to pass WithBaseURI as an option if you wish to override this behavior, but the intention is to provide a simpler interface for creating a client since it's extremely rare that developers would want to use something other than the detected environment.
type Option ¶
type Option func(*API)
func WithBaseURI ¶
WithBaseURI overrides the client base URI determined by the environment.
The value derived from stytch.EnvLive or stytch.EnvTest is already correct for production use in the Live or Test environment, respectively. This is implemented to make it easier to use this client to access internal development versions of the API.
NOTE: You should not use this in conjunction with the WithClient option since WithClient completely overrides the stytch.Client with one that may not be a stytch.DefaultClient.
func WithClient ¶
WithClient overrides the stytch.Client used by the API client. This is useful for completely mocking out requests by using something like GoMock against the stytch.Client interface to customize the responses you receive from API methods.
NOTE: You should not use this in conjunction with WithHTTPClient or WithBaseURI since the latter two assume usage of the default stytch.DefaultClient and this method completely overrides it to use anything conforming to the interface.
func WithHTTPClient ¶
WithHTTPClient overrides the HTTP client used by the API client. The default value is &http.Client{}.
NOTE: You should not use this in conjunction with the WithClient option since WithClient completely overrides the stytch.Client with one that may not be a stytch.DefaultClient.
func WithInitializationContext ¶
WithInitializationContext overrides the context used during initialization.
The context argument is used only during client setup and can be used to cancel client creation. After the client is created and returned, canceling the context has no effect. It is preferred to use this function over the less flexible NewAPIClientWithContext function, which will be deprecated in a future MAJOR release.
func WithLogger ¶
func WithSkipJWKSInitialization ¶
func WithSkipJWKSInitialization() Option
WithSkipJWKSInitialization skips the initialization of the JWKS client. This can be useful for testing purposes. Please note that if you utilize this option, any API method that makes use of the JWKS client will raise a stytcherror.JWKSNotInitialized error. If you need to call such a method, you should use WithClient or WithHTTPClient with a client that is capable of ininitalizing the JWKS keyfunc.