Sensor‐based gait recognition has recently been one of the most challenging task in personal identity verification. But the variations of sensor location would affect the quality of collected data, which results in the instability of recognition performance. To tackle with this, this paper proposes a unified discriminative Auto‐Encoder (AE) framework to directly extract discriminative features under different sensor locations, and simplifies the AE‐based framework at the same time. Firstly, we change traditional mean square error of AE into spectral angle distance to keep the geometry of data; Secondly, similar identity code is introduce to extract discriminative features; Moreover, a scatterness regularization is added to ensure the dispersion of the same class. The experimental results show the superiority of the proposed method over other state‐of‐the‐art methods. This paper proposes a unified autoencoder framework for gait recognition based on similarity identity code, which not only reduces the impact of different sensor location, but also simplifies the original progressive autoencoder scheme. The framework includes four steps: sensor‐based data collection, preprocessing, unified autoencoder algorithm and SVM recognition.