Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

  • Java / Kotlin

  • Python

  • C#

  • PHP

  • Go

  • Ruby
  • Android

  • iOS

  • Flutter

  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code

¶ 个人中心

Update Time: 2026-03-25 09:13:34
Edit

Guard 提供默认的个人中心界面,包括个人信息修改。分两种常见场景 Use :

¶ Activity

继承 Guard 里面的 UserProfileActivity

public class MeActivity extends UserProfileActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Button btn = findViewById(R.id.btn_logout);
        btn.setOnClickListener(v -> logout());
    }

    private void logout() {
        AuthClient.logout((code, message, data)->{
            // go to your home page which should in turn show login page
        });
    }
}

¶ Fragment

在需要 Use 个人中心的布局文件里面增加:

<fragment
    android:id="@+id/fragment_user_profile"
    android:name="cn.authing.guard.activity.UserProfileFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

然后在 activity 里面,增加以下代码:

private UserProfileFragment fragment;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // replace with your activity layout
    setContentView(R.layout.authing_activity_user_profile);
    fragment = (UserProfileFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_user_profile);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK && requestCode == 1000) {
        fragment.uploadAvatar(data.getData());
    }
}

更新头像需要在 Activity 里面重载 onActivityResult 函数,更新其它个人信息的逻辑已经在 UserProfileFragment 里面处理。

  • Activity
  • Fragment

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.