@textile/hub > Buckets > withUserAuth
Buckets.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): Buckets;
Parameters
Parameter | Type | Description |
---|---|---|
auth | UserAuth | (() => Promise<UserAuth>) | The UserAuth object. |
options | WithUserAuthOptions |
Returns:
Example
import { Buckets, UserAuth } from '@textile/hub'
async function example (userAuth: UserAuth) {
const buckets = await Buckets.withUserAuth(userAuth)
}