Hi All, Welcome back to Knowledge Base.. In Today's article we will see how to authenticate your app with Google using OAuth.
Following are the steps for having Google Authentication in your app.
- Create a new Project.
- Specify a project name and click on create.
- Once the project creation is done. Choose Google+ API from the list of API's.
- Click on Enable to activate the Google+ API for your project.
- Once the API is enabled, it ask to Go To Credentials Section.
- On the credentials section choose OAuth Client ID.
- It ask to create Consent Screen first (Consent Screen is which will be shown to the user to ask for permission to access his details.). Click on Configure Consent Screen to provide all the required details.
- Provide the required information like, Product Name, if any home page url, product image, privacy url etc and click on Save.
- Once the consent is saved, it will ask to create the application by choosing the type of application. Here we are choosing Web Application and click on create.
- Specify the name of the application and provide the redirect url. Finally click on Create.
- Atlast it will create you a Client Id and Client Secret, which we need to use in the application.
Once all the setup process is done. Create a Android application and add Xamarin.Auth component to the application.
Use the below code and change the respective values and run the application.
Happy Coding............. :)