这个示例将处理https://example.com的深链接。要处理其他深链接,请添加其他 配置。
https://example.com/android/callback
Auth0 auth0 = new Auth0(this);
auth0.setOIDCConformant(true); // recommended
auth0.setScope("openid profile email"); // customize your scopes
Auth0LoginActivity.show(this, auth0, new AuthCallback() {
@Override
public void onFailure(@NonNull Dialog dialog) {
// Show error dialog
}
@Override
public void onFailure(AuthenticationException exception) {
// Show error message
}
@Override
public void onSuccess(@NonNull Credentials credentials) {
// Handle successful authentication
}
}, "https://example.com/android/callback");
确保redirectUri与之前在控制面板中配置的深链接匹配。
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
if (Intent.ACTION_VIEW.equals(action) && data != null) {
// Handle deep link here...
}
在此示例中,将检查是否有ACTION_VIEW操作和数据。如果是,则处理深链接数据。
下一篇:Auth0安卓深度链接问题