Closed joshforisha closed 7 years ago
Call getPortalLoginToken using a SoftLayer:Service directly:
user_customer = SoftLayer::Service.new("SoftLayer_User_Customer") result = user_customer.getPortalLoginToken("your-username", "your-password")
Oh, I didn't even think to try that. Thanks!
However, I still get "A SoftLayer Client requires a username" from the Service.new call.
Which version of the softlayer_api gem are you using?
3.0.0
Whoops. Forgot I had a .softlayer config file. It's providing the username and API key for me. Ok. Let me re-examine.
OK. I can give you workaround, but I'll have to think about the problem in more detail to get a real fix. You might try this:
mock_client = SoftLayer::Client.new(username: "fake", api_key: "fake") def mock_client.authentication_headers {} end
service = SoftLayer::Service.new("SoftLayer_User_Customer", client: mock_client) result = service.getPortalLoginToken("your_username", "your_password").inspect
real_client = SoftLayer::Client.new(username: result["userId"].to_s, api_key: result["hash"]) puts real_client["Account"].getObject
Thanks, that will work for now.
Pull request #106 is related
This has been fixed in #106 .
The getPortalLoginToken method should not require a username or API key in order to be called for authentication, but SoftLayer::Client requires the use of both.
See http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/getPortalLoginToken