Hub JS Package

Hub JS Package

  • Users
  • Buckets
  • Threads
  • Textile Docs

@textile/hub > Filecoin > copyAuth

Filecoin.copyAuth() method

Copies the full scope and authentication from one API instance to this one. This will copy any existing authentication and authorization info, including:

  • Information created withKeyInfo and withUserAuth.

  • Any token generated from getToken or getTokenChallenge.

  • If you scoped the instance to a specific thread using withThread

Signature:

static copyAuth(auth: GrpcAuthentication, options?: CopyAuthOptions): Filecoin;

Parameters

ParameterTypeDescription
authGrpcAuthenticationany authenticated API class such as Users or Buckets.
optionsCopyAuthOptions

Returns:

Filecoin

Example 1

Copy an authenticated Users api instance to Filecoin.

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

const usersToFilecoin = async (user: Users) => {
  const filecoin = Filecoin.copyAuth(user)
  return filecoin
}

Example 2

Copy an authenticated Filecoin api instance to Users.

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

const filecoinToUsers = async (filecoin: Filecoin) => {
  const user = Users.copyAuth(filecoin)
  return user
}

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