Constructor
# new AuthGrpcService(accessToken)
Constructor
Parameters:
| Name | Type | Description |
|---|---|---|
accessToken |
string
|
The access token to authenticate the client. |
Classes
Methods
# authInterceptor(token) → {function}
Creates a gRPC interceptor to add an authorization token to request metadata.
Parameters:
| Name | Type | Description |
|---|---|---|
token |
string
|
null
|
The Bearer token to attach to outgoing gRPC requests. If |
A gRPC interceptor function that can be used with gRPC clients.
function
# async getUserById(userId) → {Promise.<User>}
Fetches a user by ID via the Auth gRPC service.
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string
|
The unique identifier of the user to fetch. |
If the user is not found or if the gRPC request fails.
Error
- The user object corresponding to the given ID.
Promise.<User>