Answers: <p>The issue was caused by not removing the space after <code>repo:</code> in the IAM Identity Provider Trust relationships' trust policy line that I had copied from the blog</p>
  <pre><code>                    &quot;token.actions.githubusercontent.com:sub&quot;: &quot;repo: &lt;aws-samples/EXAMPLEREPO&gt;:ref:refs/heads/&lt;ExampleBranch&gt;&quot;,
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-02T14:35:33.747Z
Answers: 2023-06-02T14:35:33.747Z
Answers: Edward Moffett
Body: <p>I was unable to successfully authenticate when attempting to create a GitHub Actions workflow that would authenticate with an AWS IAM Identity Provider (IdP) using Open ID Connect (OIDC), based on this blog: <a href="https://aws.amazon.com/blogs/security/use-iam-roles-to-connect-github-actions-to-actions-in-aws/" rel="nofollow noreferrer">https://aws.amazon.com/blogs/security/use-iam-roles-to-connect-github-actions-to-actions-in-aws/</a></p>
  <p>In GitHub Actions the error appeared as:</p>
  <pre><code>Not authorized to perform sts:AssumeRoleWithWebIdentity
  </code></pre>
  <p>In AWS CloudTrail the error appeared as:</p>
  <pre><code>    &quot;errorCode&quot;: &quot;AccessDenied&quot;,
      &quot;errorMessage&quot;: &quot;An unknown error occurred&quot;,
  </code></pre>
  
Tags: <amazon-web-services><aws-iam><github-actions>
Title: "An unknown error occurred" when authenticating between GitHub Actions and AWS using OIDC
UserDisplayName: Edward Moffett
ThreadText: # "An unknown error occurred" when authenticating between GitHub Actions and AWS using OIDC
  
  (Asked by: username_0 on 2023-06-02)
  
  I was unable to successfully authenticate when attempting to create a GitHub Actions workflow that would authenticate with an AWS IAM Identity Provider (IdP) using Open ID Connect (OIDC), based on this blog: <https://aws.amazon.com/blogs/security/use-iam-roles-to-connect-github-actions-to-actions-in-aws/>
  
  In GitHub Actions the error appeared as:
  
  ```
  Not authorized to perform sts:AssumeRoleWithWebIdentity
  
  ```
  
  In AWS CloudTrail the error appeared as:
  
  ```
      "errorCode": "AccessDenied",
      "errorMessage": "An unknown error occurred",
  
  ```
  
  **Tags:** amazon-web-services, aws-iam, github-actions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-06-02. Score: 1
  
  The issue was caused by not removing the space after `repo:` in the IAM Identity Provider Trust relationships' trust policy line that I had copied from the blog
  
  ```
                      "token.actions.githubusercontent.com:sub": "repo: <aws-samples/EXAMPLEREPO>:ref:refs/heads/<ExampleBranch>",
  
  ```
  
  
  ---
  
  