3

I am building a web app where all server requests are handled through AWS Gateway and Lambda. I have introduced AWS Cognito for sign-up and sign-in which works very well.

I am planning now to activate Facebook sign-up and sign-in. However, from what I understood, Facebook redirects to user after successful sign-up/in. Given that I dont really have a backend server, I was wondering whether there is an option to get the FB access token in my Javascript code without redirecting/refreshing my site?

dmi88
  • 121
  • 3
  • Are you using Cognito Userpools or Federated Identity Pools? – Ashan May 02 '18 at 00:54
  • For users that register on my page I use user pools. And for FB, I assume I will have to use identity pools. – dmi88 May 02 '18 at 04:35
  • No. You can use UserPools itself for FB which is a much cleaner solution since it handles all the complexities in the federation. – Ashan May 02 '18 at 04:37
  • Great. But is this relevant for my question regarding the FB redirection? – dmi88 May 02 '18 at 04:42
  • When you use Cognito UserPools, it manages the redirections (Unlike you have to deal it with it in Cognito Identity Pools). Once the user is successfully authenticated UserPools will issue its tokens to you. – Ashan May 02 '18 at 04:43
  • And my question is whether it is possible to avoid redirection. I have a single page application and I would like to get the FB token back in my Javascript code. (I dont use the cognito UI, I build my own page using Js libraries) – dmi88 May 02 '18 at 05:54
  • I found the solution: The FB login screen shows up in a pop-up window. After successful authentication the token is made available in my handler (javascript) code. FB is not redirecting me. – dmi88 May 07 '18 at 07:36
  • Can you please mention here a tutorial or reference you followed. We also want to implement the same functionalaty. – Lakmal Jul 25 '19 at 00:37

0 Answers0