@textile/hub > Users > withKeyInfo
Users.withKeyInfo() method
Creates a new API client instance for accessing the gRPC API using key & secret based authentication. This method is recommended for admin or insecure implementations where the non-signing keys or key with secret can be embedded directly in an app.
Signature:
static withKeyInfo(key: KeyInfo, options?: WithKeyInfoOptions): Promise<Users>;
Parameters
Parameter | Type | Description |
---|---|---|
key | KeyInfo | The KeyInfo object containing {key: string, secret: string} |
options | WithKeyInfoOptions |
Returns:
Promise<Users>
Example
import { Users, KeyInfo } from '@textile/hub'
async function start () {
const keyInfo: KeyInfo = {
key: '<api key>',
secret: '<api secret>'
}
const users = await Users.withKeyInfo(keyInfo)
}