import requests

class ssoAuthentification:
    def __init__(self):
        self.API_URL = "https://sso.inoctet.fr/"

    def verifyToken(self, token: str):
        """
        Public method to verify token validity, if it is, return user Data

        Response:
            -> Bool if request is valid
            -> Object?
        """
        try:
            api_response = requests.get(self.API_URL + "auth/session", {
                'token': token,
                'extra': 'true'
            })
            api_response = api_response.json()

            if api_response.get('status') == True:
                return [True, api_response['data']]
        except Exception as e:
            print(f"Erreur lors de la vérification du token : {e}")
            return [False, None]
        return [False, None]