Hey, Is there any way to set the error for magic l...
# ask-a-descoper
m
Hey, Is there any way to set the error for magic links to a custom error just for the expired links?
d
Magic Link Expired Error Customization Yes, you can customize error messages for expired magic links using Descope's flow error handling system. Using Flow Error Handling 1. In your flow, locate the magic link verification action (like "Verify Token") 2. Expand the error handling section for that action 3. Find the specific expired token errors: - E062504: "Token expired: Failed to load magic link token" - E063010: "Failed loading magic/enchanted link from cache, was not found, might be expired" 4. Set error handling to "Custom" instead of "Automatic" 5. Configure a custom error message or redirect to a specific screen Error Handling Options When customizing error behavior, you have these options : • Automatic: Shows default error on the last screen with custom message override • Custom: Redirect to a specific flow path or screen • Mitigate: Handle silently and continue flow You can create a dedicated error screen specifically for expired magic links and route users there when these specific error codes occur . Descope Common Errors | Descope Documentation Customizing Flow Errors | Descope Documentation Customize Magic Link Authentication | Descope Documentation
m
Not there
d
Got it — you're looking for where to find the error handling options in the Verify Token action, right? Finding Error Handling in Verify Token Action The Verify Token action should have error handling options available. Here's where to look: In the Flow Builder 1. Add or select your "Verify Token" action in your flow 2. Click on the action to expand its configuration panel 3. Scroll down to find the "Error Handling" section 4. Look for specific error types that can be customized Common Magic Link Errors to Handle The system recognizes these specific expired token errors : • E062504: "Token expired: Failed to load magic link token" • E063010: "Failed loading magic/enchanted link from cache, was not found, might be expired" If you're not seeing error handling options in your Verify Token action, try: • Refreshing the flow builder • Creating a new Verify Token action • Checking if you're using the latest version of the flow builder The error handling should appear as expandable sections within the action configuration where you can set custom messages or redirect paths. Using the Verify Token Action | Descope Documentation Descope Common Errors | Descope Documentation
m
Human please
d
The documentation doesn't cover this specifically. I'd recommend using a condition block to check for expired tokens and confirming with Descope support. Alternative Approach Since the Verify Token action may not expose granular error handling, try this workaround: Using Conditions for Error Detection 1. Add a condition after your Verify Token action 2. Check if the verification failed using flow context variables 3. Route expired token scenarios to a custom error screen The specific expired token error codes are E062504 and E063010 , but accessing these in flows may require custom error handling configuration that isn't fully documented. I'd recommend reaching out to Descope support for the exact steps to configure custom error messages specifically for expired magic link tokens in the Verify Token action. Descope Common Errors | Descope Documentation
n
@Meir Armon Yes, this can be handled in two ways. You can either customize the error message directly in the Flow action (screenshot below) or catch the specific expired magic link error (
E062504
) in your SDK implementation and display your own message there. How are you all currently sending these magic links?
m
Via flow
I don't see the option for specifying expiry error message. Our customer got the error in the image, and according to @Doron Sharon this was an expiry issue. We would want the error to be more indicative to the user.
@Nick Rodriguez? Anyone else maybe?
r
Hey Meir
Copy code
lastError.UnderlyingError.ErrorType.ErrorDesc
has this value if the token is expired
Copy code
"Token expired"
so handle this error and then catch it with a condition
image.png
m
I am not sure that I understand how to do this - How do I handle a specific errro?
r
Error handle it in the flow in section - select mitigate or continue Then using a condition check the context key against this value “Token expired”. If so you can customize the error in the condition
m
Can you please send me a screenshot of how the condition should behave?
r
image.png
m
My main concern is what I do in the "else" so that it is continued to be handled as today (still an error)
r
most of the errors would be related to token expiration so in the else, you can do the same and put the generic error you had before, or contact support message
m
I'll look into it, thanks!