stytch_codecs
Types
Response from Stytch when attempting to autenticate with any method.
pub type AuthenticateResponse {
AuthenticateResponse(
status_code: Int,
request_id: String,
user_id: String,
method_id: String,
session_token: String,
session_jwt: String,
)
}
Constructors
-
AuthenticateResponse( status_code: Int, request_id: String, user_id: String, method_id: String, session_token: String, session_jwt: String, )
Email identifying a user. Stytch separates email_id (not PII) from email and indicates whether the user has verified that they can access that address.
pub type Email {
Email(email_id: String, email: String, verified: Bool)
}
Constructors
-
Email(email_id: String, email: String, verified: Bool)
Response to a request to create or log into an account.
Used by both magic links and OTP login_or_create
pub type LoginOrCreateResponse {
LoginOrCreateResponse(
status_code: Int,
request_id: String,
user_id: String,
email_id: String,
)
}
Constructors
-
LoginOrCreateResponse( status_code: Int, request_id: String, user_id: String, email_id: String, )
Request to create a magic link. When stytch receives this request, it will send an e-mail, authenticate the user in the clicked link, and redirect back to somewhere in your service.
pub type MagicLinkLoginOrCreateRequest {
MagicLinkLoginOrCreateRequest(email: String)
}
Constructors
-
MagicLinkLoginOrCreateRequest(email: String)
Name identifying a user.
pub type Name {
Name(
first_name: String,
middle_name: String,
last_name: String,
)
}
Constructors
-
Name(first_name: String, middle_name: String, last_name: String)
pub type PasscodeAuthenticateRequest {
PasscodeAuthenticateRequest(
code: String,
method_id: String,
session_duration_minutes: Int,
)
}
Constructors
-
PasscodeAuthenticateRequest( code: String, method_id: String, session_duration_minutes: Int, )
Request to log in with a passcode. When stytch receives this it will send a passcode to the user’s e-mail address. It is up to you to process the passcode and authenticate it with stytch.
pub type PasscodeLoginOrCreateRequest {
PasscodeLoginOrCreateRequest(email: String)
}
Constructors
-
PasscodeLoginOrCreateRequest(email: String)
pub type SessionAuthenticateResponse {
SessionAuthenticateResponse(
status_code: Int,
request_id: String,
user: StytchUser,
session_token: String,
session_jwt: String,
)
}
Constructors
-
SessionAuthenticateResponse( status_code: Int, request_id: String, user: StytchUser, session_token: String, session_jwt: String, )
Request to revoke a session.
Use for signout.
pub type SessionRevokeRequest {
SessionRevokeRequest(session_token: String)
}
Constructors
-
SessionRevokeRequest(session_token: String)
Response from stytch to a request to revoke a given session token.
pub type SessionRevokeResponse {
SessionRevokeResponse(request_id: String, status_code: Int)
}
Constructors
-
SessionRevokeResponse(request_id: String, status_code: Int)
pub type SessionTokenAuthenticateRequest {
SessionTokenAuthenticateRequest(
session_token: String,
session_duration_minutes: Int,
)
}
Constructors
-
SessionTokenAuthenticateRequest( session_token: String, session_duration_minutes: Int, )
Error messages received from the stytch service
pub type StytchClientError {
StytchClientError(
status_code: Int,
request_id: String,
error_type: String,
error_message: String,
error_url: String,
)
}
Constructors
-
StytchClientError( status_code: Int, request_id: String, error_type: String, error_message: String, error_url: String, )
Request to authenticate a stytch token returned from login.
pub type TokenAuthenticateRequest {
TokenAuthenticateRequest(
token: String,
session_duration_minutes: Int,
)
}
Constructors
-
TokenAuthenticateRequest( token: String, session_duration_minutes: Int, )
Values
pub fn authenticate_response_decoder() -> decode.Decoder(
AuthenticateResponse,
)
pub fn authenticate_response_to_json(
magic_link_authenticate_response: AuthenticateResponse,
) -> json.Json
pub fn email_decoder() -> decode.Decoder(Email)
pub fn login_or_create_response_decoder() -> decode.Decoder(
LoginOrCreateResponse,
)
pub fn login_or_create_response_to_json(
magic_link_login_or_create_response: LoginOrCreateResponse,
) -> json.Json
pub fn magic_link_login_or_create_request_decoder() -> decode.Decoder(
MagicLinkLoginOrCreateRequest,
)
pub fn magic_link_login_or_create_request_to_json(
magic_link_login_or_create_request: MagicLinkLoginOrCreateRequest,
) -> json.Json
pub fn name_decoder() -> decode.Decoder(Name)
pub fn passcode_authenticate_request_decoder() -> decode.Decoder(
PasscodeAuthenticateRequest,
)
pub fn passcode_authenticate_request_to_json(
passcode_authenticate_request: PasscodeAuthenticateRequest,
) -> json.Json
pub fn passcode_login_or_create_request_decoder() -> decode.Decoder(
PasscodeLoginOrCreateRequest,
)
pub fn passcode_login_or_create_request_to_json(
passcode_login_or_create_request: PasscodeLoginOrCreateRequest,
) -> json.Json
pub fn session_authenticate_response_decoder() -> decode.Decoder(
SessionAuthenticateResponse,
)
pub fn session_authenticate_response_to_json(
session_authenticate_response: SessionAuthenticateResponse,
) -> json.Json
pub fn session_revoke_request_decoder() -> decode.Decoder(
SessionRevokeRequest,
)
pub fn session_revoke_request_to_json(
session_revoke_request: SessionRevokeRequest,
) -> json.Json
pub fn session_revoke_response_decoder() -> decode.Decoder(
SessionRevokeResponse,
)
pub fn session_revoke_response_to_json(
session_revoke_response: SessionRevokeResponse,
) -> json.Json
pub fn session_token_authenticate_request_decoder() -> decode.Decoder(
SessionTokenAuthenticateRequest,
)
pub fn session_token_authenticate_request_to_json(
session_token_authenticate_request: SessionTokenAuthenticateRequest,
) -> json.Json
pub fn stytch_client_error_decoder() -> decode.Decoder(
StytchClientError,
)
pub fn stytch_client_error_to_json(
stytch_client_error: StytchClientError,
) -> json.Json
pub fn stytch_user_decoder() -> decode.Decoder(StytchUser)
pub fn stytch_user_to_json(stytch_user: StytchUser) -> json.Json
pub fn token_authenticate_request_decoder() -> decode.Decoder(
TokenAuthenticateRequest,
)
pub fn token_authenticate_request_to_json(
token_authenticate_request: TokenAuthenticateRequest,
) -> json.Json