VestibuleClient class
Constructors
VestibuleClient ({required String serverUrl , required String tenantId , Transport? transport , GoogleSignIn? googleSignIn , FlutterSecureStorage? secureStorage , bool autoSaveTokens = false , Duration refreshBuffer = const Duration(minutes: 5) , void onTokenRefresh (String jwt , String refreshToken )?, void onTokenRefreshError (Object error )? })
Methods
clearTokens ()
→ Future <void >
Clear stored JWT and refresh token
dispose ()
→ void
Dispose of resources (call when done with the client)
getPublicKey ()
→ Future <GetPublicKeyResponse >
Get the tenant's public key for JWT verification
getStoredJWT ()
→ Future <String ? >
Get stored JWT from secure storage
getStoredRefreshToken ()
→ Future <String ? >
Get stored refresh token from secure storage
getValidJWT ()
→ Future <String ? >
Get a valid JWT, automatically refreshing if expired or expiring soon.
Returns null if no tokens are stored or refresh fails.
This is the recommended way to get a JWT for API calls.
isStoredJwtExpired ()
→ Future <bool >
Check if the stored JWT is expired
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshStoredToken ()
→ Future <bool >
Refresh the stored JWT using the stored refresh token
Returns true if successful, false if no refresh token is stored
refreshToken ({required String refreshToken })
→ Future <RefreshTokenResponse >
Refresh an expired JWT using a refresh token
requestOTP ({required String recipient , required DeliveryMethod deliveryMethod , int ? codeLength , int ? ttlSeconds , Map <String , String > ? context })
→ Future <RequestOTPResponse >
Request an OTP to be sent via email or SMS
saveTokens ({required String jwt , required String refreshToken , bool startRefreshTimer = true })
→ Future <void >
Store JWT and refresh token in secure storage
Optionally starts background refresh timer
signInWithApple ({Map <String , String > ? context })
→ Future <VerifyAppleTokenResponse >
Authenticate with Apple Sign-In
signInWithGoogle ({Map <String , String > ? context })
→ Future <VerifyGoogleTokenResponse >
Authenticate with Google Sign-In
startBackgroundRefresh ()
→ Future <void >
Start background token refresh. Call this after successful authentication.
The timer will automatically refresh tokens before they expire.
Only refreshes when the app is in the foreground.
stopBackgroundRefresh ()
→ void
Stop background token refresh
toString ()
→ String
A string representation of this object.
inherited
updateSmsOptIn ({required bool optIn , required String jwt })
→ Future <UpdateSmsOptInResponse >
Update SMS opt-in preference for the authenticated user
verifyAppleToken ({required String identityToken , Map <String , String > ? context })
→ Future <VerifyAppleTokenResponse >
Verify an Apple ID token
verifyGoogleToken ({required String idToken , Map <String , String > ? context })
→ Future <VerifyGoogleTokenResponse >
Verify a Google ID token
verifyOTP ({required String recipient , required String code , String ? verifyToken , Map <String , String > ? context })
→ Future <VerifyOTPResponse >
Verify an OTP code
willStoredJwtExpireSoon ()
→ Future <bool >
Check if the stored JWT will expire soon (within refreshBuffer)
vestibule_auth 0.0.1-beta.5