def regenerate_token()

in ees_microsoft_teams/microsoft_teams_requests.py [0:0]


    def regenerate_token(self, object_type):
        """Regenerates the access token in case of access token has expired
        :param object_type: The type of the object to get. The allowed values are teams, channels, channel_chat,
        channel_docs, calendar, user_chats, permissions and deletion
        """
        self.logger.warn("Access Token has expired. Regenerating the access token...")
        token = MSALAccessToken(self.logger, self.config)

        # Unable to fetch the CALENDAR and ATTACHMENT using the access token generated via user-password flow
        # So generating the separate access token for fetching CALENDAR and ATTACHMENT objects
        if object_type in [constant.CALENDAR, constant.ATTACHMENTS]:
            self.access_token = token.get_token(is_acquire_for_client=True)
        else:
            self.access_token = token.get_token()