         }
         let origRequest = request.mutableCopy() as! NSURLRequest
         var actualRequest = request
-        if authenticated {
+        if authenticated && getAuthKey() != nil {
             actualRequest = signRequest(request)
         }
         return session.dataTaskWithRequest(actualRequest) { (data, resp, err) -> Void in

    return nil
}

func getAuthKey() -> BRKey {
    return BRKey.init(privateKey: BRWalletManager.sharedInstance().authPrivateKey)
}

func getDeviceId() -> String {

    
    // retrieve a token and save it in the keychain data for this account
    func getToken(handler: (NSError?) -> Void) -> Void {
        if getAuthKey() == nil {
            return handler(NSError(domain: BRAPIClientErrorDomain, code: 500, userInfo: [
                NSLocalizedDescriptionKey: NSLocalizedString("Wallet not ready", comment: "")]))
        }
        let req = NSMutableURLRequest(URL: url("/token"))
        req.HTTPMethod = "POST"
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.setValue("application/json", forHTTPHeaderField: "Accept")
        let reqJson = [
            "pubKey": getAuthKey()!.publicKey.base58String(),
            "deviceID": getDeviceId()
        ]
        do {
