2012-11-21 47 views
1

我正在使用節點雲文件進行身份驗證。Rackspace授權Node.js

var cloudfiles = require('cloudfiles'); 
var config = { 
auth : { 
    username: 'my-username', 
    apiKey: 'my-api-key' 
    } 
}; 

var client = cloudfiles.createClient(config); 
console.log(client); 

而這就是我得到

{ config: 
    { auth: 
     { username: 'my-username', 
     apiKey: 'my-api-key', 
     host: 'auth.api.rackspacecloud.com' }, 
    servicenet: false }, 
    authorized: false } 

的用戶名和apiKey是正確的,它工作在PHP,但不是在node.js中

authorized: false 

- 何處是問題嗎?

回答

1

這會失敗,因爲'cloudfiles'npm模塊已被棄用。官方的GitHub頁面上這麼說:https://github.com/nodejitsu/node-cloudfiles

它也使用舊的身份驗證方式,並嘗試通過錯誤的URL進行身份驗證。我試圖將其更改爲正確的URL,但仍然無效。

我建議你用pkgcloud來代替這個模塊。 Rackspace開發人員直接爲此軟件包提供幫助,因此它應該比您嘗試使用的軟件更新。