We have an issue with Descope AWS SES Integration ...
# ask-a-descoper
m
We have an issue with Descope AWS SES Integration - Token Expiration. We are experiencing intermittent
ExpiredToken
errors when using Descope's AWS SES connector with role-based permissions. We seem to be able to force refresh by changing the role ARN. Originally we had the token expire after 1 hour - we have increased that to 12 hours. What is the token refresh frequency on the Descope side - I am hoping it is shorter than the 12 hours AWS role session duration.
m
@Daniel Newman @Michael Rimboim can you help here ?
k
Hey @Matt Gardner, on the Descope side, there isn’t a separate refresh interval, we simply rely fully on the AWS session duration you configure. You can take a look at the screenshots that I've pasted below, these should show you what the configuration should look like in your AWS environment for this SES connector. As you can see I've set the session duration length to be 1 hour, not 12 hours, which should work for you as well. I’d recommend double-checking the IAM role’s maximum session duration in the AWS Console, and ensuring the caller has the right permissions (
sts:AssumeRole
) with a
DurationSeconds
value that matches your max session duration. If you're having trouble, we can certainly hop on a call to go over the settings, or you can use our CF stack which is found in the AWS SES connector configuration page to configure this.
m
Hi @Kevin Gao - thanks for note. My takeaway is that Descope relies fully on the AWS session duration - without a separate refresh interval - is that correct? If so ( and maybe I am not fully understanding this) if Descope fully relies on the AWS session duration we configure - what happens after 12 hours? Does Descope just stop sending emails? Current Status Update: • MaxSessionDuration: Confirmed at 43,200 seconds (12 hours) - AWS maximum • Trust Policy: Verified sts:AssumeRole permissions for arnawsiam:312892722078role/prod-external-role-us-east-1 • External ID: Correctly configured and matching • Role Usage: AWS CloudTrail shows successful role assumptions You mentioned setting session duration to 1 hour instead of 12 hours. Can you clarify why a shorter duration would be preferable? Our understanding was that longer durations would reduce token expiration frequency and improve reliability. We initially used your CF stack, but it created a role with missing region in the resource ARN (arnawsses:accountidentity/email instead of arnawssesus west 2account:identity/email). We've since corrected this and increased session duration.
@Kevin Gao any thoughts on this?
d
Hey @Matt Gardner, based on the AWS IAM role assuming flow, the session duration should be aligned between two roles, the assume role will not work if there’s difference in session duration parameter. Our application handles session refresh automatically based on the JWT token response and will not affect application reliability. Having long TTL on the session token can be a potential surface of attack that we are trying to prevent.
It looks like the CloudFormation stack is missing the region — that’s a bug on our side. Thanks for pointing it out, we’ll fix it ASAP 🙏
k
Hey @Matt Gardner sorry I was on a call so I couldn't respond until now, but as far as your questions are concerned here is my response. After the 12 hours, Descope will not stop sending emails if the role is configured properly. This only happens if re-authentication/role assumption cannot re-occur, which should not be the case if the role is properly configured in AWS. As @Daniel Newman said, having a long TTL on the session token can be a potential surface of attack, and as long as the role assumption can occur at the end of the 1 hour, you shouldn't run into issues with reliability with our SES connector.
m
Thanks @Daniel Newman - we originally set our session duration to be 1 hour - everything was working great but yesterday we start seeing the
E032001 Failed to send email through SES (ExpiredToken)
errors. We only increased the session duration today to see if it worked for longer - agree on the security risk. We will revert to 1 hour. We also checked the difference between CF and our role - and spotted this:
Copy code
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ses:SendEmail",
                "ses:SendRawEmail"
            ],
            "Resource": "arn:aws:ses:us-west-2:715841348893:identity/noreply@cheggalpha.com" <<<< You simply have *
        }
    ]
}
Could that be an issue?
We wanted to make sure it could only send from this specific identity.
d
@Matt Gardner our CloudFormation template includes only the identity you set in the console. I have also fixed the region issue you mentioned above, could you please try to redeploy the CloudFormation stack again? It should work without any manual changes on your side.
also, please notice that when you are deploying the CF stack, you should keep Descope console opened until the stack is deployed, and than set the role you get from the output. If you will navigate away from the page, the unique identifier will be changed and the assume process will not work.
m
I'll do that. In the meantime, here is what we just saw inside the Descope Web App: • We went to Authentication Methods for Magic Link page and entered my email in the "test email" input box. Clicked send and it failed. • We then immediately went to the Connectors and clicked Edit on the AWS SES connector we configured - and put exact same email in the Test Configuration input and clicked Test. It succeeded. • We went back to Authentication Methods for Magic Link page and entered my email in the "test email" input box. Clicked send and it also succeeded this time. It feels like our side is working - but something is causing the intermittent TokenExpired error. Can you see your logs for my session - I am logged in as mgardner@chegg.com and my last user login ended as mgardner@chegg.com**********obfuscated********7jrd
k
Please confirm the project ID you're using:
m
P31U3xqmzG05puxvYSa1efQxtGz5 is our project!
StudyWave
k
@Matt Gardner would you be open a call to discuss this further?
m
Yep - we can hop on a zoom!
@Kevin Gao we are free until 1pm PT. The not until after 3:30pm PT.
BTW we recreated the role using the Cloudformation again and reverted to 1 hour.
k
Ok I have meetings until 1pm 😞, but we can meet at 3:30pm PST. Or @Daniel Newman can meet now potentially?
I can join for a few mins though right now.