Auth Controller [INTERNAL]

import { AuthController } from "tria-sdk-core";
const authContoller = new AuthController({ baseUrl: "http://localhost:8000" });

InitiateOTP

async initiateOTP(input: string)

input is email or phone number (phone number with country code)

Response example:-

{
    "message": "OTP sent to email.",
    "session": "AYABeJWTbdx1JyNzJMlWjtWe6vMAHQABAAdTZXJ2aWNlABBDb2duaXRvVXNlclBvb2xzAAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMTo3NDU2MjM0Njc1NTU6a2V5L2IxNTVhZmNhLWJmMjktNGVlZC1hZmQ4LWE5ZTA5MzY1M2RiZQC4AQIBAHgDHnKSW2nDRJSDSLf55TGFyX5On_wV32whMfiMxuCEIAHRuh9pIDdMfyVoBBP0j8D0AAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM4ffYKPSM9Na_7usQAgEQgDvITFFvxt54eUsbPgvyZYCt8TcbEExk7W9cUi2GCNLvOb5QKqD9w4ho7PORkot_2TSBuLzTfQI6DqMyjgIAAAAADAAAEAAAAAAAAAAAAAAAAAAJJsoh_C0HFf3LlsMoqIKW_____wAAAAEAAAAAAAAAAAAAAAEAAAEXbvg8xqYvmrBbj73Lgq6iDIUOOK6ybT5G86A36NJCRUqu6YnDxgLUNdHoMc0fKRztbOL7V-maf2ivNH6shY6eoEBnx0xNlymv2cgApXRnsLaKvZNXr5Psc7xvlF6PvKVZ3_jxbaBqNntBwMkSTAg9cY0OFSvU4GGOB9YBlpIEZntPNyiq26bKoniFMEeG4eeuNwF7QWeu6U3qDiboNq56G_vJ5D2hkdeqQ6b9P5_szhSi3JitbwldM8FvKpzz6-qQSPkohwEwz_ShzS418gr9UR2P_2nX3yuMAMwnhezvnTnqHDxI0lDpoHtoVErdw_tBYtcxtsfR5876jwX2WFCTBc_VdXY08Poci425ORJMvMZZXXpgAfwGDCrfbxtvL1eYS1f4BY-3gA"
}

Verify OTP

async verifyOTP({ otp, session, input }: { input: string, session: string, otp: string }) 

Logout

async logout(): Promise<LogoutResponse>
interface LogoutResponse {
    message: string,
    success: boolean
}

SendOTP (stytch)

async sendOTP(userId: string, method: string)

userId: email or phoneNumber method: 'email' or 'phone_number'

VerifyOTP (stytch)

async verifyOTP(code: string, methodId: string)

code: OTP methodId: it will return from sendOTP responsec

Setup Pin

async setupPin({ accessToken, pin, idToken }: { accessToken: string, pin?: string, idToken?: string }): <SetupResponse>
interface SetupResponse {
    success: boolean
}

Last updated