# Troubleshooting Identity and Access Management

Refused requests, keys that stop working, failed token exchanges and sign-ins that do not go through.

## A request answers 403 `Forbidden`

**Cause:** none of the caller's policies allows the action on that resource, or a `Deny` applies.
The body's `message` names both: `Not allowed: <action> on <resource>. Ask an administrator for a policy that allows it.`

**Fix:** open **Identity** → **Audit log** and open the refused entry. For a person's request it
has **Why? Open in the policy simulator**; otherwise simulate the action yourself. The simulator
names the `Deny` that applied, or shows that no `Allow` matched; see
[Test access with the policy simulator](test-access-with-the-simulator.md).

## The owner, or someone with `AdministratorAccess`, gets 403

**Cause:** an explicit `Deny` in one of their policies, directly, through a group or through a role.
A `Deny` wins over every `Allow`.

**Fix:** simulate the action for that user. The answer names the `Deny`, its policy and how it
reaches the user. Change or detach that policy.

## A policy with a condition grants nothing

**Cause:** the request does not supply the condition key, so an `Allow` that depends on it does not
apply. Access keys never count as signed in with a second factor; git and the container registry
carry no source address; only requests that place something in a zone carry a zone.

**Fix:** scope the condition to the requests that supply its key; see
[Policy documents](policy-documents.md#conditions).

## A read-only user cannot reveal a secret's value

**Cause:** `secrets:GetSecretValue` is a sensitive read, and no read-only policy includes one.

**Fix:** grant **Read the value** on that secret (see
[Grant access to one resource](grant-access-to-one-resource.md)), or attach a policy that allows the
action.

## A key answers 401

**Cause:** 401 `Access key has expired`; 401 `Invalid or inactive access key` for a key ID that
is inactive, deleted or does not exist; 401 `Invalid access key` for a wrong secret; 401
`Malformed access key credentials` when the key ID or the secret is not in the right form.

**Fix:** check the key under **Identity** → **Access keys**; create a new one if it has expired. See
[Manage access keys](manage-access-keys.md).

## A key answers 403 `Access key principal is not an active member of this organization`

**Cause:** the key belongs to a member whose membership is not active, for example one who was
removed from the organization. A key of an inactive IAM user answers 403 `IAM user is not active`.

**Fix:** use a key of an active user. A removed member's keys stay off even if the person is invited
again.

## `dcloud auth login` says the code expired

**Cause:** `The code expired before it was approved`: nobody approved the code in the console in
time.

**Fix:** run `dcloud auth login` again and approve it at once; see
[Sign in the CLI](sign-in-the-cli.md).

## A token exchange is refused

**Cause:** 400 `InvalidIdentityToken: token audience is not accepted by this provider` when the job
asked for an audience the identity provider does not accept; 403
`AccessDenied: not authorized to assume this role with this token` when the token's claims match
no `Allow` in the role's trust policy, or the role has none. A job that runs in a GitHub environment
carries `environment:` in its `sub`, not `ref:`.

**Fix:** request the audience the provider accepts, or compare the claims in the audit log entry
with the trust policy; see [Set a trust policy](set-a-trust-policy.md).

## An invitation link has expired

**Cause:** links are valid for 7 days.

**Fix:** on **Settings** → **Members**, choose **Resend (renews the link)** in the invitation's row
menu; see [Invite a person](invite-a-person.md).

## An IAM user cannot sign in

**Cause:** the page answers
`The organization, user name or password is not right. After several wrong attempts, sign-in pauses for a few minutes.`
for a wrong organization, user name or password, and for a locked or turned-off user alike.

**Fix:** open the user's **Console access** tab: it shows a lock or that access is off. See
[Manage console access](manage-console-access.md).

## Password sign-in is refused with "Your organization signs in with single sign-on"

**Cause:** an enforced single sign-on connection covers the address's domain.

**Fix:** use **Continue with SSO**; see [Enforce single sign-on](enforce-single-sign-on.md). Other
single sign-on errors are explained on [Single sign-on](single-sign-on.md).

## A new member of a group still cannot do the thing

**Cause:** the policy is attached to a user, not to the group.

**Fix:** attach it to the group; see [Create a group](create-a-group.md).
