Parse.com only supports facebook and twitter, but not google +, for this you need to implement your own using authentication on the cloud (parse.com)
This is a long process, so be patient.
Follow these steps
1) get google profile information for this to implement the necessary functions
put in onCreate ()
mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) //lets impement ConnectionCallbacks .addOnConnectionFailedListener(this).addApi(Plus.API) // lets implement OnConnectionFailedListener .addScope(Plus.SCOPE_PLUS_LOGIN).build(); mGoogleApiClient.connect();
2) method implemented by OnConnectionFailedListener
@Override public void onConnectionFailed(ConnectionResult result) { // TODO Auto-generated method stub if (!result.hasResolution()) { GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), getActivity(), 0).show(); return; } if (!mIntentInProgress) { // Store the ConnectionResult for later usage mConnectionResult = result; if (mSignInClicked) { // The user has already clicked 'sign-in' so we attempt to // resolve all // errors until the user is signed in, or they cancel. resolveSignInError(); } } } /** * Method to resolve any signin errors for google plus * */ private void resolveSignInError() { if (mConnectionResult.hasResolution()) { try { mIntentInProgress = true; mConnectionResult.startResolutionForResult(getActivity(), RC_SIGN_IN); } catch (SendIntentException e) { mIntentInProgress = false; mGoogleApiClient.connect(); } } }
3) call google button + click
private void loginUsingGoolgePlus() {
4) methods implemented by ConnectionCallbacks
@Override public void onConnected(Bundle arg0) { // TODO Auto-generated method stub mSignInClicked = false; Toast.makeText(getActivity(), "User is connected!", Toast.LENGTH_LONG).show(); // Get user information getProfileInformation(); } @Override public void onConnectionSuspended(int arg0) { // TODO Auto-generated method stub mGoogleApiClient.connect(); }
5) this method will give you profile information
private void getProfileInformation() { try { if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) { Person currentPerson = Plus.PeopleApi .getCurrentPerson(mGoogleApiClient); String personName = currentPerson.getDisplayName(); String personPhotoUrl = currentPerson.getImage().getUrl(); String personGooglePlusProfile = currentPerson.getUrl(); final String email = Plus.AccountApi.getAccountName(mGoogleApiClient); Log.e(TAG, "Name: " + personName + ", plusProfile: " + personGooglePlusProfile + ", email: " + email + ", Image: " + personPhotoUrl);
6) it is important here we generate one token and using this and electronic identifier, we call the script function accessGoogleUser on the cloud side (Parse.com) (this cloud code is nothing but javascript main.js
- accessGoogleUser will provide you with accessToken, using this accessToken, you can log in or register
protected void googleAuthWithParse(String email) { // TODO Auto-generated method stub String scopes = "oauth2:" + Scopes.PLUS_LOGIN + " "; String googleAuthCode = null; try { googleAuthCode = GoogleAuthUtil.getToken( getActivity(), // Context context email, // String email scopes, // String scope null // Bundle bundle ); } catch (UserRecoverableAuthException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (GoogleAuthException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //Log.i(TAG, "Authentication Code: " + googleAuthCode); final HashMap<String, Object> params = new HashMap<String, Object>(); params.put("code", googleAuthCode); params.put("email", email); //loads the Cloud function to create a Google user ParseCloud.callFunctionInBackground("accessGoogleUser", params, new FunctionCallback<Object>() { @Override public void done(Object returnObj, ParseException e) { if (e == null) { Log.e("AccessToken", returnObj.toString()); ParseUser.becomeInBackground(returnObj.toString(), new LogInCallback() { public void done(final ParseUser user, ParseException e) { if (user != null && e == null) { showToast("The Google user validated"); if(user.isNew()){ //isNew means firsttime }else{ loginSuccess(); } } else if (e != null) { showToast("There was a problem creating your account."); e.printStackTrace(); mGoogleApiClient.disconnect(); } else showToast("The Google token could not be validated"); } }); } else { if (e != null) { try { JSONObject jsonObject = new JSONObject(e.getMessage()); showToast(jsonObject.getString("message")); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } e.printStackTrace(); mGoogleApiClient.disconnect(); } } } }); }
7) How to upload cloud main.js in the cloud parse.com
carefully read and download Parse.exe and here, after loading do
place parse.exe and ParseConsole.exe in ':\Windows\System32' folder. Then search for Windows PowerShell in the start menu and run it as an administrator. Wait for the prompt in the window (mine was a blue window) to indicate it is in the ':\Windows\System32' folder. Then type '.\ParseConsole.exe' and press enter.
this is how we upload files
below the files will be created in C: \ Users \ xxxx and then image steps
1) cloud - main.js 2) config β global.json 3) public β index.html

8) download main.js from here and replace the default main.js that is created in the cloud folder
Note. don't forget to add your client id and secret to this main.js
9) also check it out. !!
Require Revocable Sessions should be false in the analysis data browser -> settings -> General
Ask me about any doubts. I am ready to help. !!