An optical identity authentication scheme based on the elliptic curve digital signature algorithm (ECDSA) and phase retrieval algorithm (PRA) is proposed. In this scheme, a user's certification image and the quick response code of the user identity's keyed-hash message authentication code (HMAC) with added noise, serving as the amplitude and phase restriction, respectively, are digitally encoded into two phase keys using a PRA in the Fresnel domain. During the authentication process, when the two phase keys are presented to the system and illuminated by a plane wave of correct wavelength, an output image is generated in the output plane. By identifying whether there is a match between the amplitude of the output image and all the certification images pre-stored in the database, the system can thus accomplish a first-level verification. After the confirmation of first-level verification, the ECDSA signature is decoded from the phase part of the output image and verified to allege whether the user's identity is legal or not. Moreover, the introduction of HMAC makes it almost impossible to forge the signature and hence the phase keys thanks to the HMAC's irreversible property. Theoretical analysis and numerical simulations both validate the feasibility of our proposed scheme.