Package com.glideidentity.service
Class MagicalAuth
java.lang.Object
com.glideidentity.service.MagicalAuth
Client for carrier-based phone number authentication.
Provides methods for SIM-based authentication flows including phone number
verification and retrieval. Handles OAuth2 token management internally.
-
Constructor Summary
ConstructorsConstructorDescriptionMagicalAuth(Config config, Logger.LoggerInterface logger) Creates a MagicalAuth service with OAuth2 authentication. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cached token, forcing a new fetch on next request.com.glideidentity.core.Types.GetPhoneNumberResponsegetPhoneNumber(com.glideidentity.core.Types.GetPhoneNumberRequest request) Retrieves the phone number using a credential from the frontend.com.glideidentity.core.Types.PrepareResponseprepare(com.glideidentity.core.Types.PrepareRequest request) Prepares an authentication session.com.glideidentity.core.Types.ReportInvocationResponsereportInvocation(com.glideidentity.core.Types.ReportInvocationRequest request) Reports an authentication invocation for metric tracking.com.glideidentity.core.Types.VerifyPhoneNumberResponseverifyPhoneNumber(com.glideidentity.core.Types.VerifyPhoneNumberRequest request) Verifies a phone number using a credential from the frontend.
-
Constructor Details
-
MagicalAuth
Creates a MagicalAuth service with OAuth2 authentication.- Parameters:
config- SDK configuration containing OAuth2 credentialslogger- Logger instance
-
-
Method Details
-
prepare
public com.glideidentity.core.Types.PrepareResponse prepare(com.glideidentity.core.Types.PrepareRequest request) throws Exception Prepares an authentication session.- Parameters:
request- prepare request parameters- Returns:
- session information and authentication strategy
- Throws:
Exception
-
verifyPhoneNumber
public com.glideidentity.core.Types.VerifyPhoneNumberResponse verifyPhoneNumber(com.glideidentity.core.Types.VerifyPhoneNumberRequest request) throws Exception Verifies a phone number using a credential from the frontend.- Parameters:
request- verification request with session and credential- Returns:
- verification result
- Throws:
Exception
-
getPhoneNumber
public com.glideidentity.core.Types.GetPhoneNumberResponse getPhoneNumber(com.glideidentity.core.Types.GetPhoneNumberRequest request) throws Exception Retrieves the phone number using a credential from the frontend.- Parameters:
request- request with session and credential- Returns:
- the phone number
- Throws:
Exception
-
reportInvocation
public com.glideidentity.core.Types.ReportInvocationResponse reportInvocation(com.glideidentity.core.Types.ReportInvocationRequest request) throws Exception Reports an authentication invocation for metric tracking. Returns the server response. For fire-and-forget usage, callers can ignore the response:// Fire-and-forget CompletableFuture.runAsync(() -> magicAuth.reportInvocation(request)); // With response ReportInvocationResponse result = magicAuth.reportInvocation(request);- Parameters:
request- request with session_id- Returns:
- response with success status
- Throws:
MagicalAuthError- if session_id is missing or request failsException
-
clearTokenCache
public void clearTokenCache()Clears the cached token, forcing a new fetch on next request.
-