Call to a member function loginByAccessToken() on string

I’m trying to set a custom model with IdentityInterface in a rest controller, but it driving me crazy, has anyone encountered this exception before?

I’ve configured a new component ‘card’ in configuration file, add a ‘bearerAuth’ in api’s controller and set Identity Interface components in my model…
Am I missing some configuration? ty

add some code as well, you are calling the function on string instead of class object as per your description.