Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

External Logins (Facebook, Google, etc)

$
0
0

I'm having problems getting this setup.  I've looked at other threads and compared to what I have and I've also looked at the links from Microsoft but I'm still missing something.

I have the Secrets enabled and even went in and ran the commands for each of my connectors i.e.:
dotnet user-secrets set Authentication:Facebook:AppSecret <ID>

Each ran successful for the AppID/ClientID and their secrets.

In the startup.cs file I have this and the order is supposed to be correct based on threads I've read (with the additions between app.useidentity and app.usemvc (I commented out all but one to test and it still has an issue, I have them all commented out right now because otherwise the site wont load (I get a HTTP 500 internal server error locally and on Azure I get An error occurred while starting the application. .NET Core X86 v4.1.1.0    |   Microsoft.AspNetCore.Hosting version 1.1.0-rtm-22752    |    Microsoft Windows 6.2.9200 ) :

app.UseIdentity();

            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            //app.UseFacebookAuthentication(new FacebookOptions()             //{             //    AppId = Configuration["Authentication:Facebook:AppId"],             //    AppSecret = Configuration["Authentication:Facebook:AppSecret"]             // });

            //app.UseGoogleAuthentication(new GoogleOptions()             //{             //    ClientId = Configuration["Authentication:Google:ClientId"],             //    ClientSecret = Configuration["Authentication:Google:ClientSecret"]             //});

            //app.UseLinkedInAuthentication(new LinkedInOptions()             //{             //    ClientId = Configuration["Authentication:LinkedIn:ClientId"],             //    ClientSecret = Configuration["Authentication:LinkedIn:ClientSecret"]             //});

            app.UseMvc(routes =>             {

                routes.MapRoute(                     name: "default",                     template: "{controller=Home}/{action=Index}/{id?}");             });         }

I did notice that in the links I found the app.UseMvc section is different than what I have.  I have my site setup for https and it launches with https so not sure if the options section is needed instead i.e. but I was getting an error with the options setting (IRouteBuilder' does not contain a definition for 'SslPort' and no extension method 'SslPort' accepting a first argument of type 'IRouteBuilder' could be found).  I don't know if this is related but since it was in the link and i haven't included it and why:

services.AddMvc(options =>
{
    options.SslPort = 44300;
    options.Filters.Add(new RequireHttpsAttribute ());
});

One last thing in the link it mentions about this section being there and it is and the "aspnet-xxxxxx" portion I'm assuming is my local repository for my user-secrets?:

            if (env.IsDevelopment())
            {
                // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets("aspnet-test-808a5125-a4d4-482e-a6ba-b1111db2f173");
            }



I'm assuming my issue with facebook will be the same for the other connectors but here's the link I'm following:

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/

thanks for the help!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>