Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication with User Pool and social provider #1521

Closed
itaied246 opened this issue Aug 28, 2018 · 25 comments
Closed

Authentication with User Pool and social provider #1521

itaied246 opened this issue Aug 28, 2018 · 25 comments
Assignees
Labels
Auth Related to Auth components/category Cognito Related to cognito issues feature-request Request a new feature

Comments

@itaied246
Copy link

As cognito docs states, one can authenticate with 3rd party providers (like Facebook) using only the user pool.

From amplify authentication docs, I followed this example, but it requires the identityPoolId.

So, how can I authenticate a user on a custom UI with a 3rd party providers using only the user pool?

@elorzafe elorzafe added Auth Related to Auth components/category Cognito Related to cognito issues question General question labels Aug 28, 2018
@mlabieniec
Copy link
Contributor

mlabieniec commented Aug 28, 2018

@itaied246 the identityPoolId comes from Cognito Federated Identities service. If you use the aws-amplify/amplify-cli you can just amplify add auth to get this setup. Then you need to configure auth (per doc you referenced above). Then pass the tokens from the third party provider (facebook etc) to the Auth.federatedSignIn() method, per the Auth guide.

@keitzer
Copy link

keitzer commented Sep 5, 2018

@mlabieniec In our instance, and I believe in @itaied246 as well... we're trying to use AWS Amplify with our React Native app in order to sign users in with Facebook / Google... BUT... into the User Pools.

We've followed this guide
https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-social-idp.html?shortFooter=true

And it works with that suggested URL at the bottom of the guide.... the facebook login with that URL goes to the User Pool.

However, when we implemented Auth.federatedSignIn(), it goes to the Identity Pool (Federated Identities)...

Is there a way to set up our login so that the Facebook (and Google) sign in can go through the User Pool? Even if it means not using AWS Amplify (although we'd love to, if possible).

Since Auth.signIn() goes through User Pool, and that guide linked above also goes through User Pool... Are we doing something wrong???

@itaied246
Copy link
Author

Anyone?

@powerful23
Copy link
Contributor

@keitzer @itaied246 if you want to sign in to the Cognito User Pool with federated providers, you should use Cognito Hosted UI: https://aws-amplify.github.io/amplify-js/media/authentication_guide.html#configuring-the-hosted-ui

Also #1143 may help you to make it work in React Native.

@itaied246
Copy link
Author

But that's the point, I don't want to use the hosted UI...
There too many customizations I need to do and the hosted UI don't offer

@powerful23
Copy link
Contributor

@itaied246 maybe you can try this: #1316 (comment)

@itaied246
Copy link
Author

Ok thanks, I'll try it.
Why doesn't amplify encapsulate it?

@powerful23
Copy link
Contributor

@itaied246 good point. I will update this in our doc.

@itaied246
Copy link
Author

@powerful23 is there a way to federate with user pool?
In the thread you sent, after authenticating with the URL you still have to federate to cognito.
In their discussion they show how to use the identity pool.

I see this question pops up a lot, in the gitter and in other issues.
This simple thing is not clear, not from amplify docs and not from cognito docs.

@powerful23
Copy link
Contributor

powerful23 commented Sep 12, 2018

@itaied246 yeah for now the only way to get federated with Cognito User Pool is through Cognito Hosted UI. The Cognito Service team is currently working on to provide another way to do that without Hosted UI and once they are done(the similar way like Auth.federatedSignIn() which is used to federate with Cognito Identity Pool), we can integrate it into Amplify ASAP.

@mtraynham
Copy link

@powerful23 is there any timeline on when that would be completed?

@mandriv
Copy link

mandriv commented Oct 26, 2018

@powerful23 do you have any updates on this issue?
Ideally, I'd like to manage users using User Pools only, without the need for identity pools for FB / Google authentication or OAuth redirects. Hope that makes sense.

@mlabieniec mlabieniec added feature-request Request a new feature and removed question General question labels Nov 5, 2018
@mlabieniec
Copy link
Contributor

you can federated directly against the social provider in your user pool via constructing a link documented in the docs:
https://aws-amplify.github.io/docs/js/authentication#launching-the-hosted-ui

see the code snippet there. You can use that link will go directly to the hosted uI, which will transparently redirect to the social provider, and then back to your application, by-passing the hosted ui all together.

@mtraynham
Copy link

@mlabieniec We’re looking for a solution that allows developers to use a custom UI, not the hosted one with redirects. This is mostly because the hosted one provides a clunky experience. Can you please reopen this?

@mlabieniec
Copy link
Contributor

Ok got it will mark as feature request

@mlabieniec mlabieniec reopened this Nov 5, 2018
@Gerharddc
Copy link

@itaied246 yeah for now the only way to get federated with Cognito User Pool is through Cognito Hosted UI. The Cognito Service team is currently working on to provide another way to do that without Hosted UI and once they are done(the similar way like Auth.federatedSignIn() which is used to federate with Cognito Identity Pool), we can integrate it into Amplify ASAP.

Would it be possible to provide Amplify with the attributes it needs to create the user pool user manually and then use https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminLinkProviderForUser.html to associate that user pool user with a federated user? I guess the answer is probably yes so the more important question is, if that is done, will Amplify be able to pick up on that link next time you sign in?

@juan-dambra
Copy link

Any updates on this new feature?

@uclaeagit
Copy link

uclaeagit commented Jan 30, 2019

We've been using the solution shown by @powerful23 here to add a custom Facebook Login button to our registration page. We also have normal Cognito user pool login with custom UI and I'm working on adding Google now.

As far as I can tell this solution is the only way to get a Facebook button working with Custom UI and User Pool only (IE - not Federated Identity Pool). But maybe I'm missing something.

@undefobj
Copy link
Contributor

Hello everyone, we have created an RFC for feature work that should make the challenges found in this issue easier in the future. If you have a moment please read through the details and add any comments: #2716

Your feedback in the RFC will help us ensure that we are delivering the best experience possible. Thank you.

@undefobj
Copy link
Contributor

undefobj commented Mar 5, 2019

Hello everyone, in addition to the above RFC we have also now released React Native support for the Hosted UI which includes an HOC which allows you to build out UI components in your app: https://aws-amplify.github.io/docs/js/authentication#launching-the-hosted-ui-in-react-native

@powerful23
Copy link
Contributor

I am going to close this issue. Please let us know if you have further concern.
The documentation about how to use OAuth is here: https://aws-amplify.github.io/docs/js/authentication#oauth-and-hosted-ui

@polson
Copy link

polson commented Mar 29, 2020

Can this be done on native app clients (iOS and Android?)

@Jun711
Copy link

Jun711 commented Apr 22, 2020

@powerful23
Regarding https://aws-amplify.github.io/docs/js/authentication#oauth-and-hosted-ui, is it only for hosted UI as the links has #oauth-and-hosted-ui?

I think this thread is asking for using custom UI?

@ianmartorell
Copy link

As of the implementation of #2716 you can call Auth.federatedSignIn({ provider: 'Facebook' }) and it will sign in using User Pool Federation provided you have Amplify configured that way.

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Auth Related to Auth components/category Cognito Related to cognito issues feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests