2016-02-12 36 views
0

我試圖使用連接器將strongloop連接到MySql DB,我能夠獲取除「用戶」之外的所有表的記錄具有以下細節:[ { "userEmailId": "string", "userPassword": "string", "firstname": "string", "lastname": "string", "roleId": 0, "mobileNumber": "string", "userStatus": 0, "createdBy": 0, "createdDate": "2016-02-12", "modifiedBy": 0, "modifiedDate": "2016-02-12", "isdeleted": 0, "oldpassword": "string", "profilePicturename": "string", "address": "string", "userId": 0, "realm": "string", "username": "string", "credentials": {}, "challenges": {}, "email": "string", "emailVerified": true, "verificationToken": "string", "status": "string", "created": "2016-02-12", "lastUpdated": "2016-02-12" } ] 我如何可以從stronglightop中的MySql連接器獲取用戶詳細信息並刪除「需要授權」

As Model Scema。

但是,當我創建獲取按鈕@網址「http://localhost:3000/explorer/#!/User/User_find

我越來越{ "error": { "name": "Error", "status": 401, "message": "Authorization Required", "statusCode": 401, "code": "AUTHORIZATION_REQUIRED", "stack": "Error: Authorization Required\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\loopback\\lib\\application.js:376:21\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\loopback\\lib\\model.js:313:7\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\loopback\\common\\models\\acl.js:465:23\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\async\\lib\\async.js:251:17\n at done (C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\async\\lib\\async.js:132:19)\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\async\\lib\\async.js:32:16\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\async\\lib\\async.js:248:21\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\async\\lib\\async.js:572:34\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\loopback\\common\\models\\acl.js:447:17\n at C:\\Users\\anupd\\Desktop\\loopback-getting-started\\node_modules\\loopback\\common\\models\\role.js:268:21" } }

能anybudy幫我解決這個問題,或者可以告訴我,我怎麼能延長inbuild用戶模塊相匹配myrequrements

在此先感謝

+0

你必須使用用戶模型的登錄方法來獲得訪問令牌,然後你要發送令牌HTTP請求標頭授權您的請求。 https://docs.strongloop.com/display/public/LB/Making+authenticated+requests –

回答

0

我們無法讀取內置USER模型。默認情況下,strongloop拒絕訪問。

您只需創建自定義模型並繼承內置USER模型,即可獲得內置USER模型的所有功能。

只要在你的model.json中做。 「基地」:「用戶」,

EX:像customer.js型號名稱

{ 
    "name": "customer", 
    "base": "User", 
    "idInjection": false, 
    "options": { 
    "validateUpsert": true 
    }, 
+0

爲什麼要投票?請看這個鏈接https://github.com/strongloop/loopback/issues/559 –

相關問題