Closed slemeur closed 3 months ago
@slemeur @gbraad @jeffmaury I have published API to get pull secret using Red Hat SSO access_token
yarn add @redhat-developer/rhaccm-client
Then somewhere in current workflow pull token
import { AccountManagementClient } from '@redhat-developer/rhaccm-client';
const authSession: extensionApi.AuthenticationSession | undefined> = await extensionApi.authentication.getSession(
'redhat.authentication-provider',
['api.iam.registry_service_accounts', //scope that gives access to hydra service accounts API
'api.console', // scope that gives access to console.redhat.com APIs
'id.username'], // adds claim to accessToken that used to render account label
{createIfNone: true} // will request to login in browser if session does not exists
);
const client = new AccountManagementClient({
BASE: 'https://api.openshift.com/api/accounts_mgmt/v1',
TOKEN: authSession.access_token,
});
const accessTokenCfg = await client.default.postApiAccountsMgmtV1AccessToken();
const pull_secret:string = JSON.stringify(accessTokenCfg);
@dgolovin @jeffmaury