diff --git a/package.json b/package.json index b87ce5dbf..5d94b452f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "3.0.0-rc11", + "version": "3.0.0-rc12", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/nevermined/NvmApp.ts b/src/nevermined/NvmApp.ts index db0768fed..4c6b8e3bb 100644 --- a/src/nevermined/NvmApp.ts +++ b/src/nevermined/NvmApp.ts @@ -196,14 +196,23 @@ export class NvmApp { this.userAccount.accountType.signerType }`, ) - const clientAssertion = await this.fullSDK.utils.jwt.generateClientAssertion( - this.userAccount, - message, - ) - console.log('Client assertion: ', clientAssertion) - this.loginCredentials = await this.fullSDK.services.marketplace.login(clientAssertion) - console.log('Login credentials: ', this.loginCredentials) + if ( + config && + config.marketplaceAuthToken && + this.fullSDK.utils.jwt.isTokenValid(config.marketplaceAuthToken) + ) { + this.loginCredentials = config.marketplaceAuthToken + } else { + const clientAssertion = await this.fullSDK.utils.jwt.generateClientAssertion( + this.userAccount, + message, + ) + console.log('Client assertion: ', clientAssertion) + + this.loginCredentials = await this.fullSDK.services.marketplace.login(clientAssertion) + console.log('Login credentials: ', this.loginCredentials) + } const nodeInfo = await this.fullSDK.services.node.getNeverminedNodeInfo() this.assetProviders = [nodeInfo['provider-address']]