updated code to include basicAuth and token based api security