How to Use Google+ API in C#

The Google+ API provides an interface to fetch information to other websites and also in Android apps. Here is the link to start with using the API.

Create Project

Click on Create Project.

Create Project

After creating the project, you will see the Project Dashboard. Go to the Credentials menu from the left side.

Project Dashboard

Create New Client ID

Now create a new Client ID. Choose Application Type “Web Application”, but when you will click on the button “Configure Consent Screen”, it will ask for some information about your Web Application.

Configure Consent Screen

Save it.

Save it

For demo puroses use the URL http://localhost:4567.

Then click on Create Client ID.

create Client ID

Keep this information safe and secure. The Client ID and Client Secret will be used in your project.

Download the application directly.

Extract it and open the gplus-quickstart-csharp.sln file in Visual Studio, then go to the Solution Explorer and open the signin.ashx.cs file.

solution explorer

In this file you will find the following.

client id

Then replace “your Client ID” from “Client ID for Web project”. Also replace “Your Client Secret” from “Client Secret”. Right-click on the project and select Enable NuGet Package Restore. Run this project.

You can see the Google Sign in button on the Web page.

Google Sign in
Click Sign in and a new window will open, then Sign in using your Gmail account and click on the Accept button. Now wait a minute. 

Then you can see your profile.

profile

You can also change the design of this page using HTML, CSS and JavaScript. This depends on you and you can attach bootstrap directly to your project. Right-click on gplus-quickstart-csharp, then choose Manage NuGet Package.

bootstrap

Install it, attach the JavaScript and CSS files to your project and design it.


Similar Articles