简体   繁体   English

如何在没有托管用户界面的情况下通过aws-amplify API使用联合身份验证?

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

AWS Cognito provides two services: user pools and identity pools. AWS Cognito提供两项服务:用户池和身份池。 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. 不想使用此功能与托管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. 我想在反应性本机应用程序中使用Facebook或Google用户池的用户池的联合登录名。 For example only with AWS sdk, for example, auth SDK from amplify. 仅以AWS sdk为例,例如amplify的auth SDK。

However, I find no possibility to use the federation login of the user pool over the API (not hosted UI). 但是,我发现无法通过API(不是托管的UI)使用用户池的联合登录。

A synonym to Auth.signIn but with federation facebook using react native, for example with expo. Auth.signIn的同义词,但使用响应本机(例如expo)与联合Facebook一起使用。

With expo i get the facebook tokens via 随着博览会,我通过获得了Facebook代币

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? 如何在没有托管用户界面的情况下通过aws-amplify API使用联合身份验证?

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. Amplify不使用用户池API通过第三方提供商进行登录,而为第三方提供商提供的API仅用于身份池。 Currently, there's a feature request with the AWS Amplify SDK team for the same. 当前,AWS Amplify SDK团队有一个功能请求。

A workaround would be to use the AUTHORIZATION Endpoint directly, and make suited HTTP requests to achieve your requirements. 一种解决方法是直接使用AUTHORIZATION端点,并进行适当的HTTP请求以实现您的要求。

Here's a post that shows how to use Google and Facebook to authenticate with the user pools. 这是一篇文章,显示了如何使用Google和Facebook对用户池进行身份验证。 It's way too much to repeat here, so check out the link. 在这里重复太多了,因此请查看链接。

https://dev.to/dabit3/the-complete-guide-to-user-authentication-with-the-amplify-framework-2inh https://dev.to/dabit3/the-complete-guide-to-user-authentication-with-the-amplify-framework-2inh

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM