def auth
      # entry point
      url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"

      # payload
      payload = {
        app: {
          name: @client.app_info[:name],
          version: @client.app_info[:version],
          vendor: @client.app_info[:vendor],
          id: @client.app_info[:id]
        },
        permissions: @client.app_info[:permissions]
      }

      # api call
      uri = URI(url)
      http = Net::HTTP.new(uri.host, uri.port)
      req = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
      req.body = payload.to_json
      res = http.request(req)

      # return's parser
      if res.code == "200"
        response = JSON.parse(res.body)

        # save it in conf.json
        conf = response.dup
        File.open(@client.app_info[:conf_path], "w") { |f| f << JSON.pretty_generate(conf) }
      else
        # puts "ERROR #{res.code}: #{res.message}"
        response = nil
      end

      # return
      response
    end
def auth
      # entry point
      url = "#{@client.app_info[:launcher_server]}#{API_VERSION}/auth"

      # payload
      payload = {
        app: {
          name: @client.app_info[:name],
          version: @client.app_info[:version],
          vendor: @client.app_info[:vendor],
          id: @client.app_info[:id]
        },
        permissions: @client.app_info[:permissions]
      }

      # api call
      uri = URI(url)
      http = Net::HTTP.new(uri.host, uri.port)
      req = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
      req.body = payload.to_json
      res = http.request(req)

      # return's parser
      if res.code == "200"
        response = JSON.parse(res.body)

        # save it in conf.json
        conf = response.dup
        File.open(@client.app_info[:conf_path], "w") { |f| f << JSON.pretty_generate(conf) }
      else
        # puts "ERROR #{res.code}: #{res.message}"
        response = nil
      end

      # return
      response
    end
Any application that wants to access API endpoints that require authorised
  access must receive an authorisation token from SAFE Launcher.

 Reading public data using the DNS API does not require an authorisation
  token. All other API endpoints require authorised access.

 The application will initiate the authorisation request with information
  about the application itself and the required permissions. SAFE Launcher
  will then display a prompt to the user with the application information
  along with the requested permissions. Once the user authorises the
  request, the application will receive an authorisation token. If the user
  denies the request, the application will receive an unauthorised error
  response.

 Usage: my_client.auth.auth(["SAFE_DRIVE_ACCESS"])
 Fail: nil
 Success: {token: "1222", "permissions": []}

 Reference: https://maidsafe.readme.io/docs/auth