Using Facebook Login with Sitecore Identity 9.3

Facebook for developers

Today we will walk through steps about extending your Sitecore Identity Server 9.3 to work with Facebook sub-provider. We will be creating a Sitecore Host plugin, which you should be familiar if your have read my previous blog on Sitecore Host Plugins.

Why Facebook Logins?

The scenario is that you would like your front door visitor to your Sitecore based website to be able to authenticate using their Facebook logins.

The good news is that Sitecore Identity Server can be configured as a federation gateway which means we can leverage Facebook as external provider with little effort.

What steps are needed?

  1. Register your Sitecore Application on the Facebook For Developers Portal. This process is to get an Application Identifier and Application Secret, that are needed in your Sitecore Instance. I will walk with you on how to do this process.
  2. Create and deploy a Sitecore Host Plugin that extends Sitecore Identity Server to support Facebook Logins. I will walk with you on how to create this plugin, with full access to the source code in my GitHub Repository

Register your Sitecore Application

Head to Facebook for Developers portal. On the portal, follow the link to create a new application. This will require you to specify the application display name after which, you will get a dashboard similar to this below.

Application Dashboard

Ensure you configure a redirect URL for your Sitecore Identity Server instance and save your changes. This will be of the format below:

https://Your_SI_Base_Url/signin-facebook

For example, my SI redirect URL is https://sc93identityserver.dev.local/signin-facebook

Creating Sitecore Host Plugin for Facebook Login

Sitecore Host Facebook Plugin

I have previously blogged on how to create a Visual Studio project for your Sitecore Host plugin. I will recommend you have a read before proceeding further.

We need to reference the Microsoft.AspNetCore.Authentication.Facebook package needed for Facebook login functionality for ASP.NET core applications. This is it.

Facebook AppId and AppSecret configuration

Within our Sitecore Host Plugin configuration file, we will define two properties as follows:

AppId – This will be mapped to the Application Identifier available from Facebook for Developers portal

AppSecret – This will be mapped to the Application secret availabe form Facebook for Developer portal

Provide definition of ConfigureServices for the Plugin

As per Sitecore Host Plugin requirements, we need to configure services for the subprovider according to the instructions for this provider, and specify the SignInScheme  setting as idsrv.external

To use authentication middleware, we must have an object of the type Microsoft.AspNetCore.Authentication.AuthenticationBuilder

To initialise this object, we must use 

new Microsoft.AspNetCore.Authentication.AuthenticationBuilder(services) 

instead of services.AddAuthentication()

Notice how we use AuthenticationBuilder(services).AddFacebook() pipeline below, which is available to us via the Microsoft.AspNetCore.Authentication.Facebook package we referenced earlier.

Facebook Plugin – ConfigureServices code listing

Facebook Plugin in Action

After successful deployment of this plugin to your instance of Sitecore Identity server, you should see the Sitecore Identity login screen below.

Please note you will need to re-start your IIS to pick the plugin changes.

Source code

This is it. You now have a working Facebook Plugin that you can deploy to your Sitecore Identity Server 9.3 instance. The full source code for this plugin is available on my public GitHub Repository.

3.10 Country/Region Specific Requirements – Windows Phone Marketplace

I recently re-submitted a previously live app to new markets. I was surprised when I was told it failed certification. Reason is Policy 3.10.

Specifically, I got this comments: Your application uses the Bing Maps Silverlight Control for Windows Phone. Bing Maps is not supported for
Group 1 countries at this time. You may resubmit your application and deselect the Group 1 countries.

Result: Fail

So watch out, don’t submit Bing Maps enabled apps to Group 1 countries, which are:

Group 1: China

Suprise yourself with this FREE Shake It Share It app

‘Shake It Share It’ is a handy pictures app to surprise you with your random pictures in your camera roll.
It uses a normal distribution randomising algorithm to surprise you with pictures in your camera roll.
And why not share your suprise on facebook with this app?

How to:

  • Auto mode: Your pictures will be randomly selected after a delay of ‘n’ milli seconds which you can change using the swttings page
  • Manual mode: Shake your phone to randomly select your pictures
  • Use settings page to configure your auto mode delay in ms (1000 ms= 1 sec)
  • To share on facebook, ensure you have paused if in auto mode, then select picture to share using ‘Back’ and ‘Next’
  • You can get it either by searching it in the market place or downloading it directly using link below

    u.k. crime map

    Shake It Share It

    View your street-level crime stats in England and Wales (United Kingdom) with this handy app

    UK Crime Map is a handy location-aware app to help you view street-level crime in streets of England and Wales in United Kingdom.
    This app uses your current location when initialising default view of the map.
    Your location is not shared in any way with any third party.
    Crimes at street-level within a 1 mile radius of a single point.
    The street-level crimes returned in the API are only an approximation of where the actual crimes occurred,
    they are NOT the exact locations.

    Police API URL: The Police API allows you to retrieve information about neighbourhood areas in
    all 43 English and Welsh police forces http://policeapi2.rkh.co.uk/api/docs/method/crime-street/

    You can get it either by searching it in the market place or downloading it directly using link below

    u.k. crime map

    U.K. Crime map

    Crime map dashboard

    Attending Tech.Ed Australia 2011? we got wp7 app for it!

    If you’re planning on attending Tech.Ed Australia 2011 conference and if you own a Windows Phone 7, please check out our new TechEdAU 2011app for Windows Phone 7 that is now available in the marketplace. You can get it either by searching it in the market place or downloading it directly using link below

    TechEdAU 2011

    TechEdAU 2011 app

    TechEdAU 2011 is a handy app for attendees of Microsoft Tech.Ed Australia 2011 conference.


    Attendees will find this app useful as follows:

    • Browse all Sessions available
    • Browse all Speakers and Tracks available
    • Browse filtered sessions by Session Type such as Breakout, Hands-on-labs
    • Browse filtered sessions by Levels such as Intermediate, Advanced, Expert
    • Browse filtered sessions by Speakers and Tracks such as Architecture, Windows Phone, etc
    • Manage favorite sessions lists on the app
    • View details of each session including schedules, speakers, tracks, level, tags
    • View session Rooms to session summary details
    • Browsing session now defaults to ‘timeslots’ view to filter Day1, Day2, Day3 (Aug 30 – Sep 2)
    • Favorite sessions now appear with a ‘favorite’ icon for easier identification on the browsing lists
    The app uses:
    * phone’s internet connection
    * phone’s web browser
    * location services
    to access the Tech.Ed 2011 Conference Session OData feeds and website resources.

    Disclaimer:
    TechEdAU 2011 app uses the official Tech.Ed Australia 2011 Conference Session OData feeds to retrieve all the content displayed.
    It also links to the official Tech.Ed 2011 website resources to serve hyperlinks.
    wp7agile is not responsible for any content displayed.

    TechEdAU 2011 uses:
    * phone’s internet connection
    * phone’s web browser
    * location services
    to access the Tech.Ed 2011 Conference Session OData feeds and website resources.
    The performance and responsiveness of this app may be affected by slow internet connections.
    By purchasing the app, you have agreed with terms and conditions.

    Have you heard of NerdDinner? now we’ve got wp7 app for it!

    This is a handy wp7 NerdDinner app to allow you browse the NerdDinner Odata to view:

    1. popular dinners
    2. upcoming dinners
    3. dinners near me
    4. my dinners
    5. search for dinners

    You can also view full details for a dinner, including its host, rsvps, phone and location on the bing maps. And its free!

    Note: This is not an official app for NerdDinner.com

    Jambo Sana app

    Quote from NerdDinner.com

    Are you a huge nerd? Perhaps a geek? No? Maybe a dork, dweeb or wonk. Quite possibly you’re just a normal person. Either way, you’re a social being. You need to get out for a bite to eat occasionally, preferably with folks that are like you.