code: def login_with_api_token(api_token):
      
      response = API.sync(api_token, '*', '["user"]')
      _fail_if_contains_errors(response)
      user_json = response.json()['user']
      # Required as sync doesn't return the api_token.
      user_json['api_token'] = user_json['token']
      return User(user_json)
docs: Login to Todoist using a user's api token.
  
      .. note:: It is up to you to obtain the api token.
  
      :param api_token: A Todoist user's api token.
      :type api_token: str
      :return: The Todoist user.
      :rtype: :class:`pytodoist.todoist.User`
  
      >>> from pytodoist import todoist
      >>> api_token = 'api_token'
      >>> user = todoist.login_with_api_token(api_token)
      >>> print(user.full_name)
      John Doe