Skip to content

Commit

Permalink
fix: to avoid reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Apr 22, 2024
1 parent b784485 commit 8ce826d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
23 changes: 16 additions & 7 deletions src/nevermined/NvmApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']]
Expand Down

0 comments on commit 8ce826d

Please sign in to comment.