-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking changes in 1.4.5 - Credentials does not create token #55
Comments
@dragos-cojocari-ibm can you please send me your config? Please remove any credentials before sending. |
@paul-carron we were using the Credentials object directly like this:
|
I don't believe instantiating credentials like that without running a web request should work. If you want to bypass the object storage calls you could use a Config object instead. const COS = require('ibm-cos-sdk');
const config = new COS.Config({
apiKeyId: 'foo'
});
config.getCredentials((err) => {
if (err) console.log(error);
console.log(config.credentials);
console.log(config.credentials.tokenManager.token.accessToken);
}); You could theoretically use the token manager directly but the API is subject to change and not guaranteed to be stable going forward. const COS = require('ibm-cos-sdk');
const TokenManager = require('ibm-cos-sdk/lib/iam/token_manager');
const tokenManager = new TokenManager({
apiKeyId: 'foo'
});
tokenManager.refreshToken()
.then(token => console.log(token)); Passing in the API key directly to a |
@dragos-cojocari-ibm did @kellerbr-ibm advice help? |
@dragos-cojocari-ibm please #close this issue if it is now resolved. |
@paul-carron @kellerbr-ibm sorry for the delay.
This did work prior to 1.4.5
This is really the key of the issue. We have been using the COS Sdk for accessing COS ans then we extended its usage to get an IAM token for other services. So if the Token Manager is not to be used directly it would be good to have this clearly documented. Based on the above the issue could be closed with the recommendation to document the TokenManager as internal. Thanks. |
Yeah, the COS token manager isn't intended to be used outside of the COS SDK itself. It sounds like you want to take a look at node-sdk-core. It contains standalone authentication functionality for IBM Cloud. |
Thanks @kellerbr-ibm Looks like that package is better suited for our needs. I'm closing this issue. |
Since 1.4.5 the Credentials constructor no longer creates a TokenManager, see fc883b5#diff-a22e85bf86882d390da68a1437c116c8 This results in refreshPromise not creating the token and returning
undefined
.With this change all code that provides only APIKeys to the Credentials object stopped working. Is the change intentional/documented?
I believe this issue is the cause for a number of other currently open issues.
The text was updated successfully, but these errors were encountered: