@textile/hub > Filecoin > withUserAuth
Filecoin.withUserAuth() method
Creates a new API client instance for accessing the gRPC API using User Group key authentication. This method is recommended for public apps where API secrets need to remain hidden from end users.
Signature:
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), options?: WithUserAuthOptions): Filecoin;
Parameters
Parameter | Type | Description |
---|---|---|
auth | UserAuth | (() => Promise<UserAuth>) | The UserAuth object. |
options | WithUserAuthOptions |
Returns:
Example
import { Filecoin, UserAuth } from '@textile/hub'
async function example (userAuth: UserAuth) {
const filecoin = await Filecoin.withUserAuth(userAuth)
}