title: Flask Sql-Alchemy, sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: PAM authentication failed for user 'abc'
body: <p>I am writing a flask application, whick uses flask-sqlalchemy library to communicate with postgres server in AWS RDS.</p>
  <p>The application works fine with just username and password. But i created a IAM user and allow him to login to postgres using the token (uses boto3's function 'generate_db_auth_token()'). using token login the get the following error.</p>
  <p>'sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL:  PAM authentication failed for user &quot;abc&quot;'</p>
  <p>This is the SQLALCHEMY_DATABASE_URI i am using with token,</p>
  <pre><code>&quot;postgresql+psycopg2://&quot;+get_conn()[0]['user']+&quot;:&quot;+str(get_conn()[0]['password'])+&quot;@&quot;+get_conn()[0]['host']+&quot;:&quot;+str(get_conn()[0]['port'])+&quot;/common?sslmode=verify-ca&amp;sslrootcert=/home/ec2-user/root.pem&quot;
  </code></pre>
  <p>Am i doing anything wrong here.</p>