Skip to content
Latchkey

Keycloak "invalid_grant: Account is not fully set up" in CI

Keycloak refused the password grant because the test user has an unresolved required action, such as UPDATE_PASSWORD or VERIFY_EMAIL. It returns invalid_grant with "Account is not fully set up".

What this error means

A direct-grant token request for a seeded user returns "error":"invalid_grant" with "Account is not fully set up". The user exists but has pending required actions.

Keycloak
{"error":"invalid_grant","error_description":"Account is not fully set up"}

Common causes

The seeded user has required actions pending

Keycloak added default required actions (update password, configure OTP, verify email) that must be cleared before login succeeds.

Email not verified with a verify-email requirement

If the realm requires verified email, an unverified test user cannot complete the grant.

How to fix it

Seed the user with no required actions

  1. Create the CI user with a permanent password and emailVerified true.
  2. Set requiredActions to an empty list.
  3. Then request the direct-grant token.
Terminal
/opt/keycloak/bin/kcadm.sh create users -r ci \
  -s username=tester -s enabled=true -s emailVerified=true \
  -s 'requiredActions=[]'
/opt/keycloak/bin/kcadm.sh set-password -r ci --username tester \
  --new-password pass --temporary=false

Clear pending actions on an existing user

Update the user to remove requiredActions and mark email verified before running login tests.

How to prevent it

  • Provision CI users with a permanent password and no required actions.
  • Set emailVerified true when the realm requires it.
  • Automate realm and user seeding as part of test setup.

Frequently asked questions

What causes ""Account is not fully set up""?
Keycloak added default required actions (update password, configure OTP, verify email) that must be cleared before login succeeds.
How do I fix "Account is not fully set up"?
Seed the user with no required actions

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card