From 59f773cbfa4dfdfabdd135e3f54ee528c4989716 Mon Sep 17 00:00:00 2001 From: Devang Gaur Date: Fri, 2 Aug 2024 06:36:52 +0530 Subject: [PATCH] add AuthRefreshToken API --- client/user.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/user.go b/client/user.go index 9b930f9c..a870a83e 100644 --- a/client/user.go +++ b/client/user.go @@ -20,6 +20,16 @@ func (h *V1Client) Authenticate(body *models.V1AuthLogin) (*models.V1UserToken, return resp.Payload, nil } +// AuthRefreshToken refreshes jwt token. +func (h *V1Client) AuthRefreshToken(token string) (*models.V1UserToken, error) { + params := clientv1.NewV1AuthRefreshParamsWithContext(h.ctx).WithToken(token) + resp, err := h.Client.V1AuthRefresh(params) + if err != nil { + return nil, err + } + return resp.Payload, nil +} + // GetUsersInfo retrieves the authenticated user info. func (h *V1Client) GetUsersInfo() (*models.V1UserInfo, error) { params := clientv1.NewV1UsersInfoGetParamsWithContext(h.ctx)