locked
Setup Google Authentication RRS feed

Answers

  • User711641945 posted

    Hi Senthil S R,

    Here are the steps about how to use Google Authentication in asp,net core 3.1 mvc:

    1.Firstly,Create a mvc project with Identity:

    2.Be sure you have Installed Microsoft.AspNetCore.Authentication.Google package.

    3.Configure the project in Google:

        1>Be sure you have created a new project in this page.

        2>Then in the Credentials menu, we have to configure a consent screen:

        

        3>Choose the External user type:

        

        4>Add the name of the application, and click the Save button at the bottom of the screen:

        

        5>There we can click the create credentials link menu and choose the OAuth client ID.

        

        6>Now, we have to choose the Application Type, Name, and add a redirect URIs(The urls port number should be your application launch url,from your description,it should be 44312) for our application:

        

        7>Once we click the Create button, we will get the ClientID and ClientSecret values:

        

    4.Add the Google service to Startup.ConfigureServices:

    services.AddAuthentication()
        .AddGoogle(options =>
        {
            IConfigurationSection googleAuthNSection =
                Configuration.GetSection("Authentication:Google");
    
            options.ClientId = googleAuthNSection["ClientId"];
            options.ClientSecret = googleAuthNSection["ClientSecret"];
        });

    5.Configure your appSettings.json:

    "Authentication": {
        "Google": {
          "ClientId": "YourClientId",
          "ClientSecret": "YourClientSecret"
        }
    }

    6.Run your application:

    Best Regards,

    Rena

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 27, 2020 6:14 AM

All replies

  • User711641945 posted

    Hi Senthil S R,

    Here are the steps about how to use Google Authentication in asp,net core 3.1 mvc:

    1.Firstly,Create a mvc project with Identity:

    2.Be sure you have Installed Microsoft.AspNetCore.Authentication.Google package.

    3.Configure the project in Google:

        1>Be sure you have created a new project in this page.

        2>Then in the Credentials menu, we have to configure a consent screen:

        

        3>Choose the External user type:

        

        4>Add the name of the application, and click the Save button at the bottom of the screen:

        

        5>There we can click the create credentials link menu and choose the OAuth client ID.

        

        6>Now, we have to choose the Application Type, Name, and add a redirect URIs(The urls port number should be your application launch url,from your description,it should be 44312) for our application:

        

        7>Once we click the Create button, we will get the ClientID and ClientSecret values:

        

    4.Add the Google service to Startup.ConfigureServices:

    services.AddAuthentication()
        .AddGoogle(options =>
        {
            IConfigurationSection googleAuthNSection =
                Configuration.GetSection("Authentication:Google");
    
            options.ClientId = googleAuthNSection["ClientId"];
            options.ClientSecret = googleAuthNSection["ClientSecret"];
        });

    5.Configure your appSettings.json:

    "Authentication": {
        "Google": {
          "ClientId": "YourClientId",
          "ClientSecret": "YourClientSecret"
        }
    }

    6.Run your application:

    Best Regards,

    Rena

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 27, 2020 6:14 AM
  • User-2054057000 posted

    Please refer  - 

    How to integrate Google login feature in ASP.NET Core Identity

    Monday, July 27, 2020 12:05 PM