skip to Main Content

I couldn’t find any documentation about how to set a Facebook API version in Terraform when integrating an AWS Cognito User Pool with it.

The block below can be deployed without any errors:

resource "aws_cognito_identity_provider" "facebook_identity_provider" {
  provider_name = "Facebook"
  provider_type = "Facebook"
  user_pool_id  = aws_cognito_user_pool.global_user_pool.id

  provider_details  = {
    authorize_scopes = "email"
    client_id        = "<client-id>"
    client_secret    = "<client-secret>
  }
  attribute_mapping = {
    email    = "email"
    username = "id"
  }
}

But then in the AWS dashboard I see this warning:

Facebook is going to deprecate Ver. 2.12 by May 1st, by which Cognito will remove our support for this API. We encourage you to select another version of API and check your attribute mappings.

The latest version is v6.0, how to set it?

2

Answers


  1. Chosen as BEST ANSWER

    It can be done with api_version inside provider_details as below:

    resource "aws_cognito_identity_provider" "facebook_identity_provider" {
      provider_name = "Facebook"
      provider_type = "Facebook"
      user_pool_id  = aws_cognito_user_pool.global_user_pool.id
    
      provider_details  = {
        api_version      = "v6.0"
        authorize_scopes = "email"
        client_id        = "<client-id>"
        client_secret    = "<client-secret>
      }
      attribute_mapping = {
        email    = "email"
        username = "id"
      }
    }
    

  2. This can also be accomplished using the AWS Cognito console.

    Old Cognito Console

    • Start opening Cognito -> Manage User Pools -> {Target User Pool}
    • Federation -> Attribute mappings
    • Then select the target provider (in this case Facebook) -> Select the Facebook graph API version you are looking for from the dropdown menu.

    New Cognito Console

    • Start by selecting the target User Pool.
    • Then Sign-in Experience -> Select the Identity provider (Facebook in this case)
    • Press Edit button of Attribute mapping
    • Then select the Facebook graph API version you are looking for.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search