Why AWS cognito asks me to which appclient to use everytime? - amazon-web-services

I am using AWS cognito for authentication purpose.
Every time i hit the cognito domain name it asks me to select the the App client.
Is there a way i can stop cognito asking me to select the Appclient i want to use for authentication.
please do let me know the way

The screenshot that you have posted asks you to select the user with whom you'd like to log in, and it has nothing to do with the App Client. Every App Client of a User Pool works with the same set of users in the pool, but with different authentication settings. If you want to select the App Client for your Cognito Authentication Engine, you can specify the App Client ID in your Cognito Hosted UI Domain. An example URL is as follows:
https://auth.example.com/login?response_type=code&client_id=<your_app_client_id>&redirect_uri=<your_callback_url>
If you specify the App Client ID in your Hosted UI Domain/Custom Domain, you can run your Engine only on that App Client.

The text following after the "Continue with" text is not the app client but your logged-in username.
After you login with your username-password credentials, a session cookie will be set on your Cognito domain to indicate you are already logged in. This session cookie expiration is not configurable and set to 1 hour expiration. The Logout Endpoint removes this session cookie.
When you re-enter the Cognito login page, it will detect you already have a session and present you with the "Continue with" page to confirm that you want to still continue as this user.
If you want to dodge this screen. You can use the Authorization Endpoint which will first check if you have the Cognito domain session, and if you do, automatically redirect you to the redirect uri (application with authorization code), otherwise it will redirect you to the login form via Login Endpoint.
https://COGNITO_SUBDOMAIN.auth.us-east-1.amazoncognito.com/oauth2/authorize?response_type=code&client_id=APP_CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code
Authorization Endpoint: https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html

Related

AWS Cognito hosted-UI and preventing concurrent user sessions

Our website prevents concurrent user sessions. User can have their session active only on 1 device/browser at the same time. Today we are switching to AWS Cognito User Pools as authentication provider. Cognito hosted UI is used for sign-in. How to prevent concurrent user sessions on Cognito?
John Doe opens our website, clicks Sign-in
His browser navigates to cognito hosted UI https://save-ca-dev.auth.us-east-2.amazoncognito.com/login?redirect_uri=http://localhost:3000/user_sessions&response_type=code&client_id=4hlhf1cvm18lkst3dm8ru8oc73
John inputs his credentials, clicks Sign-in
He is redirected back to our website. He has signed-in successfully
John Doe opens our website on another PC.
Repeats Sign-in procedure. He has signed-in successfully on another PC.
On second Sign-in, our website invalidates first user session If he tries to work on first PC - he will be anonymous user.
Let's say John goes back to first PC and directly opens Cognito hosted UI /login
Problem
Cognito still shows John as signed-in and will not ask his credentials
Desired result
Cognito should ask John's credentials. How I could achieve that?
I tried turning on Cognito Device tracking and remembering, it seems I could use ForgetDevice API. But all documentation leans towards mobile devices. Is that suitable for PC browser? Also, device tracking requires device credentials generated.
It would not be possible to obtain the desired result using the Hosted UI, with its current design.
To get the desired sign-out result, you would need to create a custom web/mobile application and utilize the LOGOUT OAuth 2.0 Endpoint and the GlobalSignOut API accordingly.
You have to logout from cognito hosted UI also when your website invalidates the session.
https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html

Cognito Signout flow not clearing cookies of ADFS from browser

I’m currently working on integrating an application using Cognito with external IdPs (ADFS) using SAML. I have done the following steps for my user pool
1)I have created a SAML identity provider by importing the metadata of my ADFS server and enabled the signout flow checkbox.
2)Added the relying party trusts in the ADFS server for my userpool. Configured the singin end point as https://.auth..amazoncognito.com/saml2/idpresponse and logout endpoint as https://.auth..amazoncognito.com/saml2/logout.
3)Imported signing certificate from cognito to the relying party trust signature section.
When I am logging in it is asking for username and password of my Active directory. But During logout the request is going to /saml/logout endpoint and I am getting a successful response. Cognito cookie is getting cleared from the browser. But my ADFS cookies still remains in the browser. Next time When I am logging it my ADFS credentials are getting picked up from the browser. Cognito signout flow is unable to clear the federated IDP's cookies even when sign out flow is enabled. How can I fix this?
although this is not an answer for your question I would like to know how you managed to authenticate users using SAML Idp?
I've setup SAML Idp and enable it in my app client.
I am trying to log in using and android app that has 2 text fields for username and password and a login button.
I get UserNotFoundException. I followed Amazon documentation and cannot find a way to get over it. I'm confused.
Funny thing is that everything works flawlessly when I log in using the auto generated UI by Cognito that is accesses using below format.
Cognito Auto Generated UI

Amazon Cognito: What is the AuthFlow when the user logs in through facebook/google/other idps?

I'm not getting a clear picture of the authentication process when a user logs in through another idp. My use case being for an app that does not need aws credentials.
If I get a token back after a user logs in from facebook for example, how do I connect that with a user in the userpool or my own database which may contain the user's app specific data?
user logs into facebook -> gets token back -> send token to amazon cognito (?) -> get back cognito token (?)
I'm currently looking for documentation on how to implement the above but there doesn't seem to be a direct link to it.
https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html
You could setup a social IdP such as Facebook and use the authorize endpoint.
Alternatively, Cognito now supports hosted signup and login pages for your application. You just need to create a Cognito domain, and set App Client Settings.

Amazon Echo Account Linking - how to identify echo device when generating and saving token?

I have a pre-existing web app with user accounts. I want to extend functionality with Amazon's echo.
When the user enables the skill in their Echo/Alexa dashboard, it will redirect them to the login page of my app with Authorization URL https://foo.com/auth.
I checked the incoming request that comes from Authorization URL https://foo.com/auth and there is no client id, user id, or user email on the request. It doesn't do me any good to generate a token and send it back to Amazon if I can't save that token on my webserver along with some kind of echo client device id.
From Account linking implicit granting
3 The user logs in using their normal credentials for your site.
4 Your service authenticates the user and then generates an access token
that uniquely identifies the user in your system.
When amazon redirects users to my app to enter login credentials, how do I link their token I give back to them to their echo device for future requests?
You don't do that when the user enter his credentials, but after the linking is completed.
When the user launches your skill, you can identify him with the context.System.user.userId, the access token will be in context.System.user.accessToken and the device in context.System.device. deviceId. The same accessToken can be used for multiple devices, and the userId will change if the user disables and re-enables your skill.
More info here: Request and Response JSON Reference

Tableau server SSO credentials issues

We have a custom PHP app, and from within that there is a link that allows users to get to our tableau server. We use SSO with SAML for authentications. When a user logs into the PHP app they are authenticated with our IdP, auth0. Then when they want to go to the tableau server that sends a SAML request to auth0.
We are having 2 issues:
1) If you go directly to the tableau server (i.e. from a browser, not from the PHP app) it sends a auth request to auth0 for the Tabadmin user. If tabadmin had previously authorized with auth0 and their session has not timed out they are granted access. How can I control what username is used by tableau when none is specified?
2) When tableau gets an access request from the PHP app it checks to see if there already is a cookie and if so, logs the user in as that cookie's user (without going to auth0) even if the request is from a different user. Is there a way to fix or control that?