0

I am trying to setup user signup and login with a Cognito user pool, Facebook and Google. I have been able to create a signup page (by following this guide) with the app integration in Cognito but would like to host the signup page along with the rest of my app. This answer has been somewhat helpful but lacks detail. I can't really find any good examples or documentation.

sam-jg
  • 85
  • 5

1 Answers1

0

You can try to do so using the authorize endpoint but it looks like this may not be possible completely. First time app authorizations seem to require the built-in UI. See my answer to a similar question here.

agent420
  • 3,291
  • 20
  • 27
  • Thanks so much. I have now been able to create users with Facebook and Google and can see them in my Cognito user pool. How do I actually authenticate the user then on subsequent visits to the site? With regular cognito users I call cognitoUser.authenticateUser() with their username and password. – sam-jg Nov 02 '17 at 23:06
  • Use same authorize endpoint for authentication too. if browser has a valid Google session it will use that or redirect to login – agent420 Nov 03 '17 at 01:50
  • So I now get redirected correctly and some type of code is added to the url. ?code=. What am I meant to do with this code? – sam-jg Nov 03 '17 at 03:35
  • This is an Oauth 2 thing. There are 2 flows implicit & code grant. In code grant, you get a code first & exchange that code for a token by sending a request to the TOKEN endpoint- http://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html – agent420 Nov 03 '17 at 04:59
  • If you want to get the token directly then while sending request to the Authorize endpoint put response_type as token instead of code. See the documentation for Authorize endpoint. – agent420 Nov 03 '17 at 05:00