Hub JS Package

Hub JS Package

  • Users
  • Buckets
  • Threads
  • Textile Docs

@textile/hub > Filecoin > getToken

Filecoin.getToken() method

Obtain a token for interacting with the remote API. When your app is creating new private-key based users to interact with the API using User Group keys, you must first create a new token for each new user. Tokens do not change after you create them.

Signature:

getToken(identity: Identity): Promise<string>;

Parameters

ParameterTypeDescription
identityIdentityA user identity to use for interacting with APIs.

Returns:

Promise<string>

Example

import { Filecoin, PrivateKey } from '@textile/hub'

async function example (filecoin: Filecoin, identity: PrivateKey) {
  const token = await filecoin.getToken(identity)
  return token // already added to `filecoin` scope
}

  • Filecoin.getToken() method
  • Parameters
  • Example
Hub JS Package
Docs
Getting StartedThreadDBBuckets
Resources
All DocumentationProject SlackBlog
More
GitHubStar
Follow @textileio