|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
AuthIdentifie avec JWTCréeAssertion pour api Graph |
Débuté par laub, 02 oct. 2025 23:32 - Aucune réponse |
| |
| | | |
|
| |
Posté le 02 octobre 2025 - 23:32 |
Bonjour,
j'essaie d'obtenir un token avec AuthIdentifie. avec comme paramètres supplémentaires pour ma variable de type OAuth2Paramètres : ParamOAuth.ParamètresSupplémentaires = ... "grant_type=client_credentials" + ... "&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" + ... "&client_assertion="+sAssertion où sAssertion est renseignée par la fonction : sAssertion = JWTCréeAssertion(<Entête JWT> , <Payload JWT> , <Certificat>).
J'obtiens systématiqement l'erreur suivante à l'appel de AuthIdentifie : Description: AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on application. [Reason - The key was not found.
Mon certificat a été chargé dans une variable de type certificat auparavant. Voici le code utilisé pour renseigner l'entête et le payload du JWT entete est un JSON entete.typ = "JWT" entete.alg = "RS256" entete.x5t = Encode(MonCertificat.Empreinte,encodeBASE64)
dateDeb est un DateHeure = MonCertificat.DateValiditéDébut dateFin est un DateHeure = MonCertificat.DateValiditéFin
sChargeUtileJSON est un JSON sChargeUtileJSON.aud = "https://login.microsoftonline.com/"+sIdTenantAnnuaire+"/oauth2/v2.0/token" sChargeUtileJSON.exp = DateHeureVersEpoch(dateFin, epochUnixSeconde) sChargeUtileJSON.iss = sIdAppli sChargeUtileJSON.jti = DonneUUID() sChargeUtileJSON.nbf = DateHeureVersEpoch(dateDeb, epochUnixSeconde) sChargeUtileJSON.sub = sIdAppli
Je ne comprends pas, avez-vous déjà utilisé un certificat pour obtenir un token ? PS : je suis sur la dernière version de Windev 2025.
Merci. |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|