Tell Google LogIn how to correctly authenticate the user, say, with Google LogIn ?
I haven't figured this out yet, so please help LogIn understand how the LogIn process should work LogIn .
It turns out, when I make a login using Google, I send a request, Google confirms it and returns a response with a specific user, I take this user’s id , mail, name and send it to the server. The server confirms this user and returns all data on it ...
But, what will happen if someone stole the user's mail, name and id and sent it to the server, and received the data, it turns out not good ...
If I understood correctly, then I need to get Token from Google, send it to the server too, when the server receives it, it will also go to Google and check that or not that token, and then everything will work as it should.
But how to get Token in this case?
Tell me, how am I in the right direction?
How should the authentication process go with the server?
EDIT
When authentication passes through Google, when you click on the button, Google gives you access to using your api .. But this has nothing to do with authentication on my server ...
It turns out I get authentication on Google and it is not clear how to properly associate it with autinfication on my server?
EDIT 2.0
public void initGoogleLogIn() { GoogleSignInOptions gso = getGoogleSignInOptions(); mGoogleApiClient = getGoogleApiClient(gso); SignInButton btnSignIn = (SignInButton) authorizationActivity.findViewById(R.id.btn_sign_in); btnSignIn.setOnClickListener(listener); } @NonNull private GoogleSignInOptions getGoogleSignInOptions() { return new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(context.getResources().getString(R.string.server_id)) .requestEmail() .build(); } @NonNull private GoogleApiClient getGoogleApiClient(GoogleSignInOptions gso) { return new GoogleApiClient.Builder(context) .enableAutoManage(authorizationActivity, listenerConnection) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // facebook FacebookImplementation.getCallbackManager() .onActivityResult(requestCode, resultCode, data); // google if (requestCode == States.GOOGLE_SIGNIN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } } private void handleSignInResult(GoogleSignInResult result) { Logger.log(ActivityAuthorization.class, ""+ result.getStatus().toString(), Logger.ERROR); if (result.isSuccess()) { Logger.log(GoogleImplementation.class, "User is connecting by Google LogIn", Logger.ERROR); // Signed in successfully, show authenticated UI. }else { Logger.log(GoogleImplementation.class, "!!!!!!!!!!!!", Logger.ERROR); } }