Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use federated Auth using aws-amplify API without hosted UI?

AWS Cognito provides two services: user pools and identity pools. Both are similar but different concepts, ok so far.

I want to use the feature federation of a user pool.

I do NOT want to use this feature with the hosted UI.

I do NOT want to use this feature with identity pool.

I would like to use the federation login of a user pool of facebook or google of a user pool in a reactive native application. For example only with AWS sdk, for example, auth SDK from amplify.

However, I find no possibility to use the federation login of the user pool over the API (not hosted UI).

A synonym to Auth.signIn but with federation facebook using react native, for example with expo.

With expo i get the facebook tokens via

const { type, token, expires } = await Expo.Facebook.logInWithReadPermissionsAsync(aws_exports.aws_facebook_id, {
  permissions: ['public_profile'],
});

How to use federated Auth using aws-amplify API without hosted UI?

like image 725
Sma Ma Avatar asked May 13 '19 19:05

Sma Ma


People also ask

What is Cognito hosted UI?

The Amazon Cognito Hosted UI provides you an OAuth 2.0 compliant authorization server. It includes default implementation of end user flows such as registration and authentication. You can also customize user flows, such as the addition of Multi Factor Authentication (MFA), by changing your user pool configuration.

How do you authenticate with tokens with Cognito?

Authenticating with tokens When a user signs into your app, Amazon Cognito verifies the login information. If the login is successful, Amazon Cognito creates a session and returns an ID, access, and refresh token for the authenticated user.

How do I import Auth in amplify?

Just run the “amplify import auth” command and Amplify CLI will automatically configure all your Amplify-provisioned resources (GraphQL APIs, S3 buckets and more) to be authenticated with your designated existing Cognito User Pool or Identity Pool.

How does amplify auth work?

Amplify Auth lets you quickly set up secure authentication flows with a fully-managed user directory. Control what users have access to in your mobile and web apps with Amplify Auth's built-in authorization capabilities.


Video Answer


1 Answers

Amplify does not use a User Pool API for signing in via a third-party provider, and the APIs offered for third-party providers are just for Identity Pools. Currently, there's a feature request with the AWS Amplify SDK team for the same.

A workaround would be to use the AUTHORIZATION Endpoint directly, and make suited HTTP requests to achieve your requirements.

like image 153
Arka Mukherjee Avatar answered Oct 08 '22 18:10

Arka Mukherjee