-
I successfully configured this npm with basic authentication, with a user id and password. Now i would like to replace with JWT tokens from z/osmf. Is there is a sample syntax program for it pls? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 22 replies
-
Hi @inv9wj1, For clarification, are you developing a program using Zowe CLI (or its SDKs)? Or are you using Zowe CLI with a Team Configuration file set up for your mainframe instance? If you are developing using Zowe CLI/SDKs, you can provide the JWT token in the const profInfo = new ProfileInfo("zowe");
await profInfo.readProfilesFromDisk();
const zosmfProfAttrs = profInfo.getDefaultProfile("zosmf");
const zosmfMergedArgs = profInfo.mergeArgsForProfile(zosmfProfAttrs, { getSecureVals: true });
const session = imperative.ProfileInfo.createSession(zosmfMergedArgs.knownArgs);
// Specify JWT token type and value on the session object.
session.ISession.tokenType = "jwtToken";
session.ISession.tokenValue = "<your JWT here>";
const dataset = "ZOWEUSER.PUBLIC.YOUR.DATASET.HERE";
const options: IDownloadOptions = { failFast: false };
const response = await Download.allMembers(session, dataset, options); If you are using a z/OSMF profile with Zowe CLI and want to authenticate using JWT, you can specify a token type and token value on your profile. The provided token will be used to authenticate future requests. Note: If your environment supports using secure credentials with Zowe CLI, I would recommend saving the properties securely so that they are not shown in plaintext. Use the following Zowe CLI commands to store the
Otherwise, you can provide the "zosmf": {
"type": "zosmf",
"properties": {
"tokenType": "jwtToken",
"tokenValue": "<your JWT here>"
}
} |
Beta Was this translation helpful? Give feedback.
Hi @inv9wj1,
For clarification, are you developing a program using Zowe CLI (or its SDKs)? Or are you using Zowe CLI with a Team Configuration file set up for your mainframe instance?
If you are developing using Zowe CLI/SDKs, you can provide the JWT token in the
tokenValue
property of a session, and then you can use that session with our available APIs. For example, with the z/OS Files SDK: