Search code examples
bashamazon-web-servicestwitteramazon-cognitoaws-cli

How to set twitter app consumer credentials in amazon cognito via CLI


Trying out this from the CLI

aws cognito-identity update-identity-pool \
--identity-pool-id MyIdentityPoolId \
--identity-pool-name MyIdentityPoolName \
--allow-unauthenticated-identities \
--supported-login-providers graph.facebook.com=MyFacebookAppId,api.twitter.com=MyTwitterConsumerKey;MyTwitterConsumerSecret \
--region $MyRegion

The CLI response says:

{
    "SupportedLoginProviders": {
        "api.twitter.com": "MyTwitterConsumerKey",
        "graph.facebook.com": "MyFacebookAppId"
    }, 
    "AllowUnauthenticatedIdentities": true, 
    "IdentityPoolName": "MyIdentityPoolName", 
    "IdentityPoolId": "MyIdentityPoolId"
}
MyTwitterConsumerSecret: command not found

Unlike configuring facebook (which requires only one credential (the FacebookAppId), configuring twitter requires 2 credentials (ConsumerKey and ConsumerSecret).

If i am delimiting the 2 credentials by a semi-colon, looks like only the first part is getting set in the twitter configuration for amazon cognito. Screenshot attached.

Twitter configuration for Amazon Cognito

What is the format to pass BOTH ConsumerKey and ConsumerSecret for configuring twitter?


I referred to these AWS docs:


Solution

  • Ok. How silly. Simply needed to scope the credentials for --supported-login-providers within double-quotes.

    --supported-login-providers graph.facebook.com="MyFacebookAppId",api.twitter.com="MyTwitterConsumerKey;MyTwitterConsumerSecret" 
    

    Then it worked.

    {
        "SupportedLoginProviders": {
            "api.twitter.com": "MyTwitterConsumerKey;MyTwitterConsumerSecret",
            "graph.facebook.com": "MyFacebookAppId"
        }, 
        "AllowUnauthenticatedIdentities": true, 
        "IdentityPoolName": "MyIdentityPoolName", 
        "IdentityPoolId": "MyIdentityPoolId"
    }
    

    Screenshot attached. enter image description here