I am using AWS Cognito to build out the authentication layer for my React app, and I'm trying to go for the quickest win possible. I'm using Terraform to build my backend, and have successfully got Google working as an identity provider. Now I want to add Github, but I'm unable to find any sample Terraform resources that I can use for this. I am using the hosted UI to test the configuration, but will copy the links directly into my react app once it's all working.
I have created an OAuth application in GitHub and used the credentials from that.
Here is my resource for the GitHub identity provider (which I came up with largely with the help from copilot):
resource "aws_cognito_identity_provider" "github_provider" {
user_pool_id = aws_cognito_user_pool.user_pool.id
provider_name = "GitHub"
provider_type = "OIDC"
provider_details = {
authorize_scopes = "openid"
client_id = "XXXXXXXXXXXXXXXXX"
client_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
oidc_issuer = "https://token.actions.githubusercontent.com"
attributes_request_method = "GET"
}
attribute_mapping = {
username = "sub"
}
}
In the hosted UI I can then see my GitHub authentication button:
However, if I click the link, it immediately goes to my callback with the error without going to GitHub:
http://localhost:3000/callback?error_description=Unsupported+configuration+for+OIDC+Identity+Provider.+Please+review+the+documentation+for+specification.&error=server_error
"Unsupported configuration for OIDC Identity Provider. Please review the documentation for specification."
I can't find any description of this error message on Google and it doesn't help explain what the problem is. Can anyone help?