@textile/hub > Client > getTokenChallenge
Client.getTokenChallenge() method
Obtain a token per user (identity) for interacting with the remote API.
Signature:
getTokenChallenge(publicKey: string, callback: (challenge: Uint8Array) => Uint8Array | Promise<Uint8Array>, ctx?: ContextInterface): Promise<string>;
Parameters
| Parameter | Type | Description | 
|---|---|---|
| publicKey | string | The public key of a user identity to use for creating records in the database. A random identity can be created with `Client.randomIdentity(), however, it is not easy/possible to migrate identities after the fact. Please store or otherwise persist any identity information if you wish to retrieve user data later, or use an external identity provider. | 
| callback | (challenge: Uint8Array) => Uint8Array | Promise<Uint8Array> | A callback function that takes a challengeargument and returns a signed message using the input challenge and the private key associated withpublicKey. | 
| ctx | ContextInterface | Context object containing web-gRPC headers and settings. | 
Returns:
Promise<string>
Remarks
publicKey must be the corresponding public key of the private key used in callback.