If you are using your own Custom UI, you will need to create a button/anchor
to redirect to the user.
This is what I use to create a url (JS Code):
`https://${domain}/oauth2/authorize`,
`?redirect_uri=${redirectSignIn}`,
`&response_type=${responseType}`,
`&client_id=${userPoolWebClientId}`,
`&identity_provider=${providerName.toString()}`
providerName
is either Facebook/Google
responseType
is either token/code
domain
your domain in cognito userpool config
redirectSignIn
your redirect sign in in Cognito User Pool Config
You will need to call window.location.assign({the url generated above})
. When user clicks the button, it will redirect to either Facebook/Google page asking for Account/Permission.
As for as I know, Facebook/Google dialog for custom UI is not yet supported.
Example code from AWS Amplify
import { Auth } from 'aws-amplify';
const config = Auth.configure();
const {
domain,
redirectSignIn,
redirectSignOut,
responseType } = config.oauth;
const clientId = config.userPoolWebClientId;
// The url of the Cognito Hosted UI
const url = 'https://' + domain + '/login?redirect_uri=' + redirectSignIn + '&response_type=' + responseType + '&client_id=' + clientId;
// Launch hosted UI
window.location.assign(url);
Link: https://aws-amplify.github.io/docs/js/authentication
Another thing, you can link federated identity to a user pool account.
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#adminLinkProviderForUser-property