'API returning an object instead of string

I have an API that I set calls with refit, however when calling it I'm receiving an object instead of a string, I don't get what the issue is here.

var userToken = await apiClient.LoginuserBySsnAsync(ssn);

the definition of the API call:

        /// <summary>
        /// Login user by SSN.
        /// </summary>
        /// <param name="ssn">user SSN in 12 digit format.</param>
        /// <returns>user token.</returns>
        [Get("/api/login/loginssn")]
        Task<string> LoginUserBySsnAsync(string ssn);

and in this case the return I'm getting in "userToken" is:

"{\"userToken\":\"rgkjnrekljgtlwgktkwljhnglterkjhnyJuYmYiOjE2NDM2NjAxNDMsImV4cCI6MTY0NjA3OTM0MywiUGF0aWVudHNzbiwerlfkrlkgfnrejgnlrekjglmeMc\"}"

when I execute in the API directly (swagger) the response I get is:

{
  "userToken": "rgkjnrekljgtlwgktkwljhnglterkjhnyJuYmYiOjE2NDM2NjAxNDMsImV4cCI6MTY0NjA3OTM0MywiUGF0aWVudHNzbiwerlfkrlkgfnrejgnlrekjglmeMc"
}

where what I would expect is:

"rgkjnrekljgtlwgktkwljhnglterkjhnyJuYmYiOjE2NDM2NjAxNDMsImV4cCI6MTY0NjA3OTM0MywiUGF0aWVudHNzbiwerlfkrlkgfnrejgnlrekjglmeMc"

I'm not sure what the issue is as I don't have a lot of experience here, but I appreciate any help to improve



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source