Skip to content

Commit 4403ce0

Browse files
committed
CU-8698tgj89: add custom method to retrieve access token for external pages
1 parent 782f164 commit 4403ce0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/bss/adapters/portaswitch/adapter.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,4 +738,13 @@ def _custom_pages(self, user_id: str, data: CustomRequest, lang: str = None) ->
738738

739739
return CustomResponse(pages=pages)
740740

741+
def _external_page_access_token(self, user_id: str, data: CustomRequest, lang: str = None) -> CustomResponse:
742+
account_info = self._admin_api.get_account_info(i_account=user_id).get("account_info")
743+
session_data = self._account_api.login(account_info["login"], account_info["password"])
744+
745+
return CustomResponse(
746+
token=session_data['access_token'],
747+
expires_at=datetime.now(UTC) + timedelta(seconds=session_data["expires_in"])
748+
)
749+
741750
# endregion

0 commit comments

Comments
 (0)