2016-11-29 88 views
0

您好:使用SoftLayer API REST,我有一個方法,在啓動密碼重置時工作正常。 (電子郵件發送給最終用戶)但是,當我遇到使用新的OpenIdConnect的新用戶設置時,我收到一個錯誤:{u'code':u'SoftLayer_Exception_Public', u'error':u'This用戶是通過OpenIdConnect認證,並且必須使用OpenIdConnect提供商更改他們的密碼。「}SoftLayer API OpenIdConnect重置密碼

所以,我說的返回狀態的檢查和任何錯誤,這樣在遇到當消息OpenIdConnect我使用新的方法SoftLayer_User_Customer_OpenIdConnect重新嘗試/ initiatePortalPasswordChange。但是這不起作用。它返回一個具有相同錯誤信息的500。

我的方法的一個簡單的例子是:

def set_user_password(self): 
    ''' This method initiates a portal password reset process.''' 


    myUser = { 
     "parameters" : [self.username] 
    } 


    restreq = self._url('SoftLayer_User_Customer/initiatePortalPasswordChange.json') 
    #print(restreq+"""',"""+' json=hwlist') 
    r = requests.post(restreq, json=myUser) 
    #pp(r) 
    #pp(r.json()) 
    result = r.json() 
    if 'SoftLayer_Exception_Public' in result['code']: 
     print("Exception found - checking error") 
    else: 
     print("Unknown error.") 
     return() 
    if 'OpenIdConnect' in result['error']: 
     print("OpenIdConnect error - this user is part of the new OpenID") 
     newrestreq = self._url('SoftLayer_User_Customer_OpenIdConnect/initiatePortalPasswordChange.json') 
     newr = requests.post(newrestreq, json=myUser) 
     pp(newr) 
     pp(newr.json()) 

的方法,上述發送第二POST請求但錯誤回具有相同的誤差,因爲如果不支持該方法的SoftLayer。下面,我運行它:

發現異常 - 錯誤檢查 OpenIdConnect錯誤 - 該用戶是新的OpenID {u'code的一部分 ':u'SoftLayer_Exception_Public', u'error':u'This '} 無

回答

0

問題是因爲您的用戶創建的是blueId用戶,所以這意味着您將無法使用更改密碼來使用SoftLayer的API。您需要更改密碼或使用bluemix api重置密碼。

也通過UI:https://myibm.ibm.com/dashboard/(登錄到IBMid後)

+0

唉..謝謝。我的印象是OpenIdConnect的方法可以通過SoftLayer API來實現。我在這裏閱讀另一個評論,關於這個遷移期間沒有向後兼容性嘆息..感謝您的迴應。 –