Try your search with a different keyword or use * as a wildcard.
using Nop.Core;
using Nop.Plugin.ExternalAuth.Facebook.Components;
using Nop.Services.Authentication.External;
using Nop.Services.Configuration;
using Nop.Services.Localization;
using Nop.Services.Plugins;
namespace Nop.Plugin.ExternalAuth.Facebook;
///
/// Represents method for the authentication with Facebook account
///
public class FacebookAuthenticationMethod : BasePlugin, IExternalAuthenticationMethod
{
#region Fields
protected readonly ILocalizationService _localizationService;
protected readonly ISettingService _settingService;
protected readonly IWebHelper _webHelper;
#endregion
#region Ctor
public FacebookAuthenticationMethod(ILocalizationService localizationService,
ISettingService settingService,
IWebHelper webHelper)
{
_localizationService = localizationService;
_settingService = settingService;
_webHelper = webHelper;
}
#endregion
#region Methods
///
/// Gets a configuration page URL
///
public override string GetConfigurationPageUrl()
{
return $"{_webHelper.GetStoreLocation()}Admin/FacebookAuthentication/Configure";
}
///
/// Gets a type of a view component for displaying plugin in public store
///
/// View component type
public Type GetPublicViewComponent()
{
return typeof(FacebookAuthenticationViewComponent);
}
///
/// Install the plugin
///
/// A task that represents the asynchronous operation
public override async Task InstallAsync()
{
//settings
await _settingService.SaveSettingAsync(new FacebookExternalAuthSettings());
//locales
await _localizationService.AddOrUpdateLocaleResourceAsync(new Dictionary
{
["Plugins.ExternalAuth.Facebook.AuthenticationDataDeletedSuccessfully"] = "Data deletion request completed",
["Plugins.ExternalAuth.Facebook.AuthenticationDataExist"] = "Data deletion request is pending, please contact the admin",
["Plugins.ExternalAuth.Facebook.ClientKeyIdentifier"] = "App ID/API Key",
["Plugins.ExternalAuth.Facebook.ClientKeyIdentifier.Hint"] = "Enter your app ID/API key here. You can find it on your FaceBook application page.",
["Plugins.ExternalAuth.Facebook.ClientSecret"] = "App Secret",
["Plugins.ExternalAuth.Facebook.ClientSecret.Hint"] = "Enter your app secret here. You can find it on your FaceBook application page.",
["Plugins.ExternalAuth.Facebook.Instructions"] = "To configure authentication with Facebook, please follow these steps:
- Navigate to the Facebook for Developers page and sign in. If you don't already have a Facebook account, use the Sign up for Facebook link on the login page to create one.
- Tap the + Add a New App button in the upper right corner to create a new App ID. (If this is your first app with Facebook, the text of the button will be Create a New App.)
- Fill out the form and tap the Create App ID button.
- The Product Setup page is displayed, letting you select the features for your new app. Click Get Started on Facebook Login.
- Click the Settings link in the menu at the left, you are presented with the Client OAuth Settings page with some defaults already set.
- Enter \"{0:s}signin-facebook\" into the Valid OAuth Redirect URIs field.
- From User data deletion dropdown menu select \"Data deletion instructions URL\"
- Enter \"{0:s}facebook/data-deletion-callback/\" into the User data deletion input field.
- Click Save Changes.
- Click the Dashboard link in the left navigation.
- Copy your App ID and App secret below.
"
});
await base.InstallAsync();
}
///
/// Uninstall the plugin
///
/// A task that represents the asynchronous operation
public override async Task UninstallAsync()
{
//settings
await _settingService.DeleteSettingAsync();
//locales
await _localizationService.DeleteLocaleResourcesAsync("Plugins.ExternalAuth.Facebook");
await base.UninstallAsync();
}
#endregion
}