我搜索了许多链接,但没有找到有关以下内容的任何教程: https://developers.google.com/identity/sign-in/android/backend-auth
我要配置我的后端服务器以进行Google身份验证
我的android代码:
element(by.xpath("//input[@class='jfk-button jfk-button-action dUBGpe']"));
element(by.css("jfk-button.jfk-button-action.dUBGpe"));
如何在我的节点js应用程序中通过Facebook登录将google idToken转换为jwt令牌:
我的节点js Authentication.je文件:
public class SignInActivity extends AppCompatActivity {
SharedPreferences.Editor editor;
GoogleSignInClient mGoogleSignInClient;
private int RC_SIGN_IN = 101;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
SignInButton signInButton = findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
//Shared Preferences Editor
editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
// Callback registration
signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
// The Task returned from this call is always completed, no need to attach
// a listener.
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
String idToken = account.getIdToken();
// Signed in successfully, show authenticated UI.
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information.
}
}}
我访问过的链接: https://developers.google.com/identity/sign-in/android/backend-auth