hyperledger fabric-ca-client through javascript registering more than one user using the same admin identity but unable to access channel from User2 , User3 and so forth #fabric-ca

maruti praturi

Everything works fine when I have just "user1" who is registered using the following lines of code

const secret = await ca.register({ affiliation: 'org1.department1', enrollmentID: 'user1', role: 'client', extra: 'client1'}, adminIdentity);
const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: secret });
const userIdentity = fabric_network_1.X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes());
await wallet.import('user1', userIdentity);

When I add one more user "user2", it gets registered. But when I try to discover the channel, while running this below line of code

const network = await gateway.getNetwork('mychannel');

I get the below error

[Channel.js]: Channel:mychannel received discovery error:access denied

I have declared 2 users in count in crypto-config.yaml, still, I am getting this error.

Join fabric@lists.hyperledger.org to automatically receive all group messages.