@textile/hub > Client > withUserAuth
Client.withUserAuth() method
Create a new gRPC client instance from a supplied user auth object. Assumes all default gRPC settlings. For customization options, use a context object directly. The callback method will automatically refresh expiring credentials.
Signature:
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), host?: string, debug?: boolean): Client;
Parameters
Parameter | Type | Description |
---|---|---|
auth | UserAuth | (() => Promise<UserAuth>) | The user auth object or an async callback that returns a user auth object. |
host | string | |
debug | boolean |
Returns:
Example 1
import {UserAuth, Client} from '@textile/hub'
function create (auth: UserAuth) {
return Client.withUserAuth(auth)
}
Example 2
import {UserAuth, Client} from '@textile/hub'
function setCallback (callback: () => Promise<UserAuth>) {
return Client.withUserAuth(callback)
}