Closed rizwans-cuelogic closed 7 years ago
I passed region name to cognito constructor but same exception is coming
I am having the same issue as @rizwans-cuelogic. Passing the user_pool_region
argument returns an error.
u = Cognito('your-user-pool-id', 'your-client-id', user_pool_region='us-east-1')
Returns this error:
botocore.exceptions.NoRegionError: You must specify a region.
EDIT: I fixed this by passing my AWS access and secret key. Maybe there should be a warning message if no AWS access key or secret key is passed to the constructor?
@atwalsh04 your instance functions are working properly? because in cognito constructor code there is nothing given about AWS access and secret key as parameter.
@faizans-cuelogic Yes, the arguments for this are access_key
and secret_key
.
This line is from the Cognito constructor:
if access_key and secret_key:
self.client = boto3.client('cognito-idp',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
region_name=self.user_pool_region
)
else:
self.client = boto3.client('cognito-idp')
If you do not pass these to the constructor, boto3 looks for AWS credentials as defined in the boto3 Credentials Configuration.
You've gotta tell Boto3 what region to use somehow (the region in which your Cognito user pool exists); either by passing it as an argument to
Cognito
orAWSSRP
in this library, or setting theAWS_DEFAULT_REGION
environment variable, or defining an AWS config file.