Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Google Login API with Cordova/Phonegap

I want to use "Login with Google" in my Phonegap App. I have read many articles but couldn't find out how it is done. Thanks in Advance. I tried using oAuth2 for "installed Applications" as per this URL. But then the app users have to manually copy code and paste in my app. I am using built.io Federated Login, if its relevant.

like image 432
Augustus Francis Avatar asked May 29 '14 10:05

Augustus Francis


People also ask

Is Cordova discontinued?

Apache Cordova Is Retired: Alternatives for Cross Platform Mobile Development in 2022. Future trends of cross-platform mobile development are already starting to emerge, and it appears that Apache Cordova won't be included in the list of frameworks that power hybrid web apps for mobile devices.

How do I add a browser platform to Cordova?

Before you begin working with the Browser platform, there are a few things you should know. First, you have to actually add the platform. That means running cordova platform add browser . And if you want the latest, then you need to specify cordova platform add [email protected] .

What is Cordova API?

Cordova is an open-source mobile development framework. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development, avoiding each mobile platforms' native development language.


1 Answers

Google has dropped support for the accepted answer above! After April 20th 2017 use of the In-App browser as described by @Deep Mehta will no longer be supported. If you use the accepted answer then it is going to start failing very soon.

Here's Google's post about the change: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html

Luckily there's a new plugin that wraps up all the funcitonality that you need to do this:

https://github.com/EddyVerbruggen/cordova-plugin-googleplus and on NPM https://www.npmjs.com/package/cordova-plugin-googleplus

Here's an article on how to use it in Ionic 1 and 2 also: http://blog.ionic.io/google-oauth-changes

Again - DO NOT USE THE ACCEPTED ANSWER! It will fail after April 20 2017.

like image 131
Nico Westerdale Avatar answered Sep 20 '22 20:09

Nico Westerdale