The first thing we need to do is to create the Facebook app. Doing that is just as easy as following the mentioned steps:
- Go to the Facebook Developer page at https://developers.facebook.com/.
- Once inside, click on Add a New App:, select Website, fill in the required fields, and click on Create App ID:
- As soon as we get past the CAPTCHA, a new Facebook app will be added to our account, and we'll be automatically brought to the Add Products selection screen.
- Once there, we should be able to add a new Facebook Login product by selecting the appropriate card and clicking on the Set Up button:
We should then be prompted by a wizard-like view where you can choose between various platforms: iOS, Android, Web, and Other; we can choose Web and go ahead.
In the following wizard-like screen, we'll be asked for our main website URL. Ensure that you specify the development URL there, including the port:
http://localhost:14600/
In the subsequent parts of the wizard, we'll be given the chance to read about the Facebook JavaScript SDK, which is the client-side framework made by Facebook with the intent to provide web developers a standard, easy-to-use interface to implement the whole auth process to their website. Take a good look at those sample code lines, because that's precisely what we'll use when implementing our implicit flow, with some minor changes to make them work in Angular.
Once done, select the Facebook Login | Settings link from the left menu. From there, we can enter our production and development URIs with the /auth/signin-facebook route suffix in the Valid OAuth Redirect URIs input field:
We're free to chose a different route if we prefer to, as long as we'll configure it within our web application later on. Anyway, when we're done, we can click on Save Changes and go ahead.
By clicking on the Settings link in the left navigation menu, we can retrieve the AppId and AppSecret of our Facebook App--ensure that you write them down--and configure some additional information regarding our Facebook App: the Display Name, the App Icon, the WebSite URL we entered a short while ago, and so on. None of them are required, so we can skip everything and click on the App Review link, where we have the chance to make our app available to the public. All we need to do here is to turn the switch on:
As soon as we do that, we will see a list of Approved Items, containing the default information we'll be able to access when our users will confirm their choice to log in to our site with Facebook; as we can see, the first one among them is the user email address, which we'll need soon enough.