AuthO how to get logged in user details not from token but from Users function in iOS swift

I want to fetch the logged in user details but currently we aren’t receiving from token so I need to call users api but as I am using sdk in my swift ui project when I was trying to use Users function to get the details from get function I am unable to receive any of the data only info , so can anyone help me on that ?

here is the :

public func loginWithBrowser(method: AuthMethod, process: AuthProcess) async throws -> JWTUser {
    do {
      let ids = getClientAuth0()
      let credentials = try await webAuth.start(with: ids, method: method, process: process)
      
      let staticDomain = <My Domain>
      
      if let userInfo = try await webAuth.getUserDetails(token: credentials.accessToken, domain: staticDomain)?.get("user-id", fields: ["email", "user_id"]){
        
        debugPrint("CPSAuthO line 84 : userInfo: \(userInfo)")
      }

"CPSAuthO line 84 : userInfo: Request<Dictionary<String, Any>, ManagementError>(session: <__NSURLSessionLocal: 0x104206b50>, url: https://<domain>/api/v2/users/user-id?fields=email,user_id&include_fields=true, method: \"GET\", handle: (Function), parameters: [:], headers: [\"Authorization\": \"Bearer <token>\"], logger: nil, telemetry: Auth0.Telemetry(enabled: true, info: Optional(\"eyJuYW1lIjoiQXV0aDAuc3dpZnQiLCJ2ZXJzaW9uIjoiMi4xMC4wIiwiZW52Ijp7ImlPUyI6IjE4LjEiLCJzd2lmdCI6IjUueCJ9fQ\")))"

Hi @brinda,

Welcome to the Auth0 Community!

I have reviewed your code snippet and noticed that webAuth.getUserDetails() is not a callable method in the current Auth0 Swift SDK. However, I found this example, which shows how to retrieve the user information.

Here is the code snippet:

Auth0
   .authentication()
   .userInfo(withAccessToken: credentials.accessToken)
   .start { result in
       switch result {
       case .success(let user):
           print("Obtained user: \(user)")
       case .failure(let error):
           print("Failed with: \(error)")
       }
   }

In this example, the response will return the user claims from the /userinfo endpoint.

Let me know how this goes for you.

Thanks,
Rueben