diff --git a/dy-java-common/src/main/java/com/dyj/common/domain/DySimpleResult.java b/dy-java-common/src/main/java/com/dyj/common/domain/DySimpleResult.java index cfaacf5..87fb730 100644 --- a/dy-java-common/src/main/java/com/dyj/common/domain/DySimpleResult.java +++ b/dy-java-common/src/main/java/com/dyj/common/domain/DySimpleResult.java @@ -4,7 +4,7 @@ package com.dyj.common.domain; * @author danmo * @date 2024-04-09 11:30 **/ -public class DySimpleResult { +public class DySimpleResult { private String err_msg; @@ -12,6 +12,8 @@ public class DySimpleResult { private String log_id; + private T data; + public String getErr_msg() { return err_msg; } @@ -36,12 +38,21 @@ public class DySimpleResult { this.log_id = log_id; } + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + @Override public String toString() { return "{" + "err_msg='" + err_msg + '\'' + ", err_no=" + err_no + ", log_id='" + log_id + '\'' + + ", data=" + data + '}'; } } diff --git a/dy-java-common/src/main/java/com/dyj/common/enums/DyConfigEnum.java b/dy-java-common/src/main/java/com/dyj/common/enums/DyConfigEnum.java index 78f6b3f..7359a22 100644 --- a/dy-java-common/src/main/java/com/dyj/common/enums/DyConfigEnum.java +++ b/dy-java-common/src/main/java/com/dyj/common/enums/DyConfigEnum.java @@ -240,8 +240,32 @@ public enum DyConfigEnum { */ COMMENT_REPLY("commentReply","/item/comment/reply"), + /** + * H5分享跳转链接获取 + */ + SCHEMA_GET_SHARE("schemaGetShare","/api/douyin/v1/schema/get_share"), + /** + * 个人页跳转链接获取 + */ + SCHEMA_GET_USER_PROFILE("schemaGetUserProfile","/api/douyin/v1/schema/get_user_profile"), + + /** + * 个人会话页跳转链接获取 + */ + SCHEMA_GET_USER_CHAT("schemaGetUserChat","/api/douyin/v1/schema/get_chat"), + + /** + * 视频详情页跳转链接获取 + */ + SCHEMA_GET_ITEM_INFO("schemaGetItemInfo","/api/douyin/v1/schema/get_item_info"), + + /** + * 直播间跳转链接获取 + */ + SCHEMA_GET_LIVE("schemaGetLive","/api/douyin/v1/schema/get_live"), + ; diff --git a/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java b/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java index 2827127..152a028 100644 --- a/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java +++ b/dy-java-common/src/main/java/com/dyj/common/service/IAgentTokenService.java @@ -11,7 +11,7 @@ public interface IAgentTokenService { UserTokenInfo getTokenInfo(Integer tenantId, String clientKey, String openId) throws AuthTokenNotFoundException; - void setClientTokenInfo(Integer tenantId, String clientKey, String accessToken, Long expiresIn) throws AuthTokenNotFoundException; + ClientTokenInfo setClientTokenInfo(Integer tenantId, String clientKey, String accessToken, Long expiresIn); ClientTokenInfo getClientTokenInfo(Integer tenantId, String clientKey) throws AuthTokenNotFoundException; diff --git a/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java b/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java index 4519921..e975194 100644 --- a/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java +++ b/dy-java-common/src/main/java/com/dyj/common/service/impl/CacheAgentTokenServiceImpl.java @@ -3,7 +3,6 @@ package com.dyj.common.service.impl; import com.dyj.common.domain.ClientTokenInfo; import com.dyj.common.domain.UserTokenInfo; import com.dyj.common.exception.AuthTokenNotFoundException; -import com.dyj.common.exception.OpenIdIsNullException; import com.dyj.common.service.IAgentTokenService; import java.util.Map; @@ -32,7 +31,7 @@ public class CacheAgentTokenServiceImpl implements IAgentTokenService { @Override public UserTokenInfo getTokenInfo(Integer tenantId, String clientKey, String openId) throws AuthTokenNotFoundException { - UserTokenInfo userTokenInfo = userTokenMap.get(String.format("%s_%s_%s", tenantId, clientKey,openId)); + UserTokenInfo userTokenInfo = userTokenMap.get(String.format("%s_%s_%s", tenantId, clientKey, openId)); if (Objects.isNull(userTokenInfo)) { throw new AuthTokenNotFoundException("token not found"); } @@ -40,11 +39,12 @@ public class CacheAgentTokenServiceImpl implements IAgentTokenService { } @Override - public void setClientTokenInfo(Integer tenantId, String clientKey, String accessToken, Long expiresIn) throws AuthTokenNotFoundException { + public ClientTokenInfo setClientTokenInfo(Integer tenantId, String clientKey, String accessToken, Long expiresIn){ ClientTokenInfo clientTokenInfo = new ClientTokenInfo(); clientTokenInfo.setAccessToken(accessToken); clientTokenInfo.setExpiresIn(expiresIn); clientTokenMap.put(String.format("%s_%s", tenantId, clientKey), clientTokenInfo); + return clientTokenInfo; } @Override @@ -53,6 +53,4 @@ public class CacheAgentTokenServiceImpl implements IAgentTokenService { } - - } diff --git a/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java b/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java index faf3031..bf286af 100644 --- a/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java +++ b/dy-java-web/src/main/java/com/dyj/web/DyWebClient.java @@ -551,4 +551,54 @@ public class DyWebClient { return new CommentHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).commentReply(query); } + /** + * H5分享跳转链接获取 + * @param query 入参 + * @return DySimpleResult + */ + public DySimpleResult getH5Share(GetH5ShareQuery query) { + return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getH5Share(query); + } + /** + * 个人页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getUserProfile(String openId, String account, Long expireAt) { + return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getUserProfile(openId, account, expireAt); + } + /** + * 个人会话页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + DySimpleResult getUserChat(String openId,String account, Long expireAt){ + return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getUserChat(openId, account, expireAt); + } + /** + * 视频详情页跳转链接获取 + * @param itemId 视频ID + * @param videoId 视频ID + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getItem(String itemId, String videoId, Long expireAt) { + return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getItem(itemId, videoId, expireAt); + } + + /** + * 直播间页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getLive(String openId,String account, Long expireAt) { + return new SchemaHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getLive(openId, account, expireAt); + } + } diff --git a/dy-java-web/src/main/java/com/dyj/web/client/SchemaClient.java b/dy-java-web/src/main/java/com/dyj/web/client/SchemaClient.java new file mode 100644 index 0000000..1173d07 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/client/SchemaClient.java @@ -0,0 +1,54 @@ +package com.dyj.web.client; + +import com.dtflys.forest.annotation.BaseRequest; +import com.dtflys.forest.annotation.JSONBody; +import com.dtflys.forest.annotation.Post; +import com.dtflys.forest.backend.ContentType; +import com.dyj.common.domain.DySimpleResult; +import com.dyj.web.domain.query.BaseQuery; +import com.dyj.web.domain.query.GetH5ShareQuery; +import com.dyj.web.domain.vo.SchemaShareVo; +import com.dyj.web.interceptor.ClientTokenInterceptor; + +/** + * 场景跳转接口 + * + * @author danmo + * @date 2024-04-11 11:17 + **/ + +@BaseRequest(baseURL = "${domain}", contentType = ContentType.APPLICATION_JSON) +public interface SchemaClient { + + /** + * H5分享跳转链接获取 + * + * @param query 入参 + */ + @Post(value = "${schemaGetShare}", interceptor = ClientTokenInterceptor.class) + DySimpleResult getH5Share(@JSONBody GetH5ShareQuery query); + + /** + * 个人页跳转链接获取 + */ + @Post(value = "${schemaGetUserProfile}", interceptor = ClientTokenInterceptor.class) + DySimpleResult getUserProfile(@JSONBody BaseQuery query, @JSONBody("open_id") String openId,@JSONBody("account") String account, @JSONBody("expire_at") Long expireAt); + + /** + * 个人会话页跳转链接获取 + */ + @Post(value = "${schemaGetUserChat}", interceptor = ClientTokenInterceptor.class) + DySimpleResult getUserChat(@JSONBody BaseQuery query, @JSONBody("open_id") String openId,@JSONBody("account") String account, @JSONBody("expire_at") Long expireAt); + + /** + * 视频详情页跳转链接获取 + */ + @Post(value = "${schemaGetItem}", interceptor = ClientTokenInterceptor.class) + DySimpleResult getItem(@JSONBody BaseQuery query, @JSONBody("item_id") String itemId, @JSONBody("video_id") String videoId, @JSONBody("expire_at") Long expireAt); + + /** + * 直播间跳转链接获取 + */ + @Post(value = "${schemaGetLive}", interceptor = ClientTokenInterceptor.class) + DySimpleResult getLive(@JSONBody BaseQuery query, @JSONBody("open_id") String openId, @JSONBody("account") String account, @JSONBody("expire_at") Long expireAt); +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/MiroAppInfo.java b/dy-java-web/src/main/java/com/dyj/web/domain/MiroAppInfo.java new file mode 100644 index 0000000..88239af --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/MiroAppInfo.java @@ -0,0 +1,24 @@ +package com.dyj.web.domain; + +/** + * @author danmo + * @date 2024-04-11 11:33 + **/ +public class MiroAppInfo { + /** + * 小程序appId + */ + private String appId; + /** + * 标题 + */ + private String appTitle; + /** + * 小程序地址 + */ + private String appUrl; + /** + * 小程序描述 + */ + private String description; +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/query/GetH5ShareQuery.java b/dy-java-web/src/main/java/com/dyj/web/domain/query/GetH5ShareQuery.java new file mode 100644 index 0000000..599d1b8 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/query/GetH5ShareQuery.java @@ -0,0 +1,243 @@ +package com.dyj.web.domain.query; + +import com.dyj.web.domain.MiroAppInfo; + +import java.util.List; + +/** + * @author danmo + * @date 2024-04-11 11:28 + **/ +public class GetH5ShareQuery extends BaseQuery{ + + /** + * client_ticket + */ + private String client_ticket; + + /** + * 过期时间 + */ + private String expire_at; + + /** + * 支持有第三方预设内容分享抖音时默认携带的话题 + */ + private List hashtag_list; + + /** + * 图片文件路径(多个),图集模式分享 + */ + private List image_list_path; + + /** + * 添加小程序。视频成功发布视频后,在视频左下角带有小程序入口。 + */ + private List micro_app_info; + + /** + * 地理位置信息锚点id,与小程序appId互斥,优先展示小程序。 + */ + private String poi_id; + + /** + * 为1时直接分享到抖音发布页(仅视频) + */ + private Integer share_to_publish; + + /** + * 建议填写,按照文档获取share_id,可以获取视频发布情况 + */ + private String state; + /** + * 视频标题 + */ + private String title; + + /** + * 视频文件路径(单个,不能超过128M)。 + */ + private String video_path; + + public String getClient_ticket() { + return client_ticket; + } + + public void setClient_ticket(String client_ticket) { + this.client_ticket = client_ticket; + } + + public String getExpire_at() { + return expire_at; + } + + public void setExpire_at(String expire_at) { + this.expire_at = expire_at; + } + + public List getHashtag_list() { + return hashtag_list; + } + + public void setHashtag_list(List hashtag_list) { + this.hashtag_list = hashtag_list; + } + + public List getImage_list_path() { + return image_list_path; + } + + public void setImage_list_path(List image_list_path) { + this.image_list_path = image_list_path; + } + + public List getMicro_app_info() { + return micro_app_info; + } + + public void setMicro_app_info(List micro_app_info) { + this.micro_app_info = micro_app_info; + } + + public String getPoi_id() { + return poi_id; + } + + public void setPoi_id(String poi_id) { + this.poi_id = poi_id; + } + + public Integer getShare_to_publish() { + return share_to_publish; + } + + public void setShare_to_publish(Integer share_to_publish) { + this.share_to_publish = share_to_publish; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getVideo_path() { + return video_path; + } + + public void setVideo_path(String video_path) { + this.video_path = video_path; + } + + public static GetH5ShareQueryBuilder builder() { + return new GetH5ShareQueryBuilder(); + } + + public static class GetH5ShareQueryBuilder { + private String clientTicket; + private String expireAt; + private List hashtagList; + private List imageListPath; + private List microAppInfo; + private String poiId; + private Integer shareToPublish; + private String state; + private String title; + private String videoPath; + + + public GetH5ShareQueryBuilder clientTicket(String clientTicket) { + this.clientTicket = clientTicket; + return this; + } + + public GetH5ShareQueryBuilder expireAt(String expireAt) { + this.expireAt = expireAt; + return this; + } + + public GetH5ShareQueryBuilder hashtagList(List hashtagList) { + this.hashtagList = hashtagList; + return this; + } + + public GetH5ShareQueryBuilder imageListPath(List imageListPath) { + this.imageListPath = imageListPath; + return this; + } + + public GetH5ShareQueryBuilder microAppInfo(List microAppInfo) { + this.microAppInfo = microAppInfo; + return this; + } + + public GetH5ShareQueryBuilder poiId(String poiId) { + this.poiId = poiId; + return this; + } + + public GetH5ShareQueryBuilder shareToPublish(Integer shareToPublish) { + this.shareToPublish = shareToPublish; + return this; + } + + public GetH5ShareQueryBuilder state(String state) { + this.state = state; + return this; + } + + public GetH5ShareQueryBuilder title(String title) { + this.title = title; + return this; + } + + public GetH5ShareQueryBuilder videoPath(String videoPath) { + this.videoPath = videoPath; + return this; + } + + public GetH5ShareQuery build() { + GetH5ShareQuery getH5ShareQuery = new GetH5ShareQuery(); + getH5ShareQuery.setClient_ticket(clientTicket); + getH5ShareQuery.setExpire_at(expireAt); + getH5ShareQuery.setHashtag_list(hashtagList); + getH5ShareQuery.setImage_list_path(imageListPath); + getH5ShareQuery.setMicro_app_info(microAppInfo); + getH5ShareQuery.setPoi_id(poiId); + getH5ShareQuery.setShare_to_publish(shareToPublish); + getH5ShareQuery.setState(state); + getH5ShareQuery.setTitle(title); + getH5ShareQuery.setVideo_path(videoPath); + return getH5ShareQuery; + } + + } + + @Override + public String toString() { + return "GetH5ShareQuery{" + + "client_ticket='" + client_ticket + '\'' + + ", expire_at='" + expire_at + '\'' + + ", hashtag_list=" + hashtag_list + + ", image_list_path=" + image_list_path + + ", micro_app_info=" + micro_app_info + + ", poi_id='" + poi_id + '\'' + + ", share_to_publish=" + share_to_publish + + ", state='" + state + '\'' + + ", title='" + title + '\'' + + ", video_path='" + video_path + '\'' + + ", tenantId=" + tenantId + + ", clientKey='" + clientKey + '\'' + + '}'; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/vo/ClientTokenVo.java b/dy-java-web/src/main/java/com/dyj/web/domain/vo/ClientTokenVo.java index 7c418b2..a571e0b 100644 --- a/dy-java-web/src/main/java/com/dyj/web/domain/vo/ClientTokenVo.java +++ b/dy-java-web/src/main/java/com/dyj/web/domain/vo/ClientTokenVo.java @@ -13,7 +13,7 @@ public class ClientTokenVo extends BaseVo{ /** * access_token接口调用凭证超时时间,单位(秒) */ - private Integer expires_in; + private Long expires_in; public String getAccess_token() { @@ -24,11 +24,11 @@ public class ClientTokenVo extends BaseVo{ this.access_token = access_token; } - public Integer getExpires_in() { + public Long getExpires_in() { return expires_in; } - public void setExpires_in(Integer expires_in) { + public void setExpires_in(Long expires_in) { this.expires_in = expires_in; } diff --git a/dy-java-web/src/main/java/com/dyj/web/domain/vo/SchemaShareVo.java b/dy-java-web/src/main/java/com/dyj/web/domain/vo/SchemaShareVo.java new file mode 100644 index 0000000..530c181 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/domain/vo/SchemaShareVo.java @@ -0,0 +1,28 @@ +package com.dyj.web.domain.vo; + +/** + * @author danmo + * @date 2024-04-11 11:41 + **/ +public class SchemaShareVo { + + /** + * Schema链接 + */ + private String schema; + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + @Override + public String toString() { + return "SchemaShareVo{" + + "schema='" + schema + '\'' + + '}'; + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/handler/AbstractWebHandler.java b/dy-java-web/src/main/java/com/dyj/web/handler/AbstractWebHandler.java index 827c3de..cb98262 100644 --- a/dy-java-web/src/main/java/com/dyj/web/handler/AbstractWebHandler.java +++ b/dy-java-web/src/main/java/com/dyj/web/handler/AbstractWebHandler.java @@ -3,6 +3,7 @@ package com.dyj.web.handler; import com.dyj.common.config.AgentConfiguration; import com.dyj.spring.utils.SpringUtils; import com.dyj.web.client.*; +import com.dyj.web.domain.query.BaseQuery; /** * @author danmo @@ -47,4 +48,12 @@ public abstract class AbstractWebHandler { protected CommentClient getCommentClient() { return SpringUtils.getBean(CommentClient.class); } + protected SchemaClient getSchemaClient() { + return SpringUtils.getBean(SchemaClient.class); + } + + void setBaseQuery(BaseQuery query){ + query.setTenantId(agentConfiguration.getTenantId()); + query.setClientKey(agentConfiguration.getClientKey()); + } } diff --git a/dy-java-web/src/main/java/com/dyj/web/handler/SchemaHandler.java b/dy-java-web/src/main/java/com/dyj/web/handler/SchemaHandler.java new file mode 100644 index 0000000..6f4be77 --- /dev/null +++ b/dy-java-web/src/main/java/com/dyj/web/handler/SchemaHandler.java @@ -0,0 +1,80 @@ +package com.dyj.web.handler; + +import com.dtflys.forest.annotation.JSONBody; +import com.dyj.common.config.AgentConfiguration; +import com.dyj.common.domain.DySimpleResult; +import com.dyj.web.domain.query.BaseQuery; +import com.dyj.web.domain.query.GetH5ShareQuery; +import com.dyj.web.domain.vo.SchemaShareVo; + +/** + * @author danmo + * @date 2024-04-11 11:54 + **/ +public class SchemaHandler extends AbstractWebHandler { + public SchemaHandler(AgentConfiguration agentConfiguration) { + super(agentConfiguration); + } + + /** + * H5分享跳转链接获取 + * @param query + * @return + */ + public DySimpleResult getH5Share(GetH5ShareQuery query) { + setBaseQuery(query); + return getSchemaClient().getH5Share(query); + } + + /** + * 个人页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getUserProfile(String openId, String account, Long expireAt) { + BaseQuery query = new BaseQuery(); + setBaseQuery(query); + return getSchemaClient().getUserProfile(query, openId, account, expireAt); + } + + /** + * 个人会话页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getUserChat(String openId, String account, Long expireAt){ + BaseQuery query = new BaseQuery(); + setBaseQuery(query); + return getSchemaClient().getUserChat(query, openId, account, expireAt); + } + + /** + * 视频详情页跳转链接获取 + * @param itemId 视频ID + * @param videoId 视频ID + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getItem(String itemId, String videoId, Long expireAt){ + BaseQuery query = new BaseQuery(); + setBaseQuery(query); + return getSchemaClient().getItem(query, itemId, videoId, expireAt); + } + + /** + * 直播间页跳转链接获取 + * @param openId 用户ID + * @param account 抖音号 + * @param expireAt 生成短链过期时间 + * @return DySimpleResult + */ + public DySimpleResult getLive(String openId,String account, Long expireAt){ + BaseQuery query = new BaseQuery(); + setBaseQuery(query); + return getSchemaClient().getLive(query, openId,account, expireAt); + } +} diff --git a/dy-java-web/src/main/java/com/dyj/web/interceptor/ClientTokenInterceptor.java b/dy-java-web/src/main/java/com/dyj/web/interceptor/ClientTokenInterceptor.java index 76e6243..62bb210 100644 --- a/dy-java-web/src/main/java/com/dyj/web/interceptor/ClientTokenInterceptor.java +++ b/dy-java-web/src/main/java/com/dyj/web/interceptor/ClientTokenInterceptor.java @@ -10,8 +10,11 @@ import com.dyj.common.domain.DyResult; import com.dyj.common.domain.UserTokenInfo; import com.dyj.common.handler.RequestHandler; import com.dyj.common.service.IAgentTokenService; +import com.dyj.common.utils.DyConfigUtils; +import com.dyj.web.DyWebClient; import com.dyj.web.domain.query.BaseQuery; import com.dyj.web.domain.query.UserInfoQuery; +import com.dyj.web.domain.vo.ClientTokenVo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,13 +35,18 @@ public class ClientTokenInterceptor implements Interceptor { } } - IAgentTokenService agentTokenService = RequestHandler.getInstance().getDyConfiguration().getAgentTokenService(); + IAgentTokenService agentTokenService = DyConfigUtils.getAgentTokenService(); ClientTokenInfo clientTokenInfo = agentTokenService.getClientTokenInfo(tenantId, clientKey); if (Objects.isNull(clientTokenInfo)) { - throw new RuntimeException("access_token is null"); + ClientTokenVo clientToken = DyWebClient.getInstance().tenantId(tenantId).clientKey(clientKey).clientToken().getData(); + if(Objects.nonNull(clientToken) && clientToken.getError_code() == 0){ + clientTokenInfo = agentTokenService.setClientTokenInfo(tenantId, clientKey, clientToken.getAccess_token(), clientToken.getExpires_in()); + } } - request.addBody("access-token", clientTokenInfo.getAccessToken()); - return Interceptor.super.beforeExecute(request); + if (Objects.nonNull(clientTokenInfo)) { + request.addBody("access-token", clientTokenInfo.getAccessToken()); + } + return true; } @Override