PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Contact Google via l'API People
Contact Google via l'API People
Started by christophe, Oct., 08 2019 6:21 PM - 1 reply
Posted on October, 08 2019 - 6:21 PM
Bonjour,
A cause d'un dysfonctionnement sur la gestion des contacts google avec les fonctions windev (le nom du contact n'est pas renseigné lorsqu'on ajoute un contact) je souhaite utiliser l'api people. Je rencontre cependant un problème
Je récupère bien mon token avec la fonction AuthIdentifie, par contre lorsque je lance ma requête http pour ajouter mon contact j'ai une erreur 403 ("Request had insufficient authentication scopes."). A priori il me manque le scope "https://www.googleapis.com/auth/contacts".
Je ne vois pas où je peux l'ajouter. Quelqu'un peut-il m'aider ?

Le code que j'utilise :

toto est un OAuth2Paramètres

toto..ClientID="monidclientgoogle"
toto..ClientSecret="monclientsecretgoogle"
toto..URLAuth="https://accounts.google.com/o/oauth2/auth"
toto..URLRedirection="http://localhost:15000"
toto..URLToken="https://oauth2.googleapis.com/token"
toto..Scope="profile email"
MonToken est un AuthToken = AuthIdentifie(toto)
SI ErreurDétectée ALORS
Erreur(ErreurInfo)
FIN

req est un httpRequête
req..Méthode = httpPost
//req..AuthToken = MonToken // Token d'authentification
req..ContentType = "application/json"
req.URL="https://people.googleapis.com/v1/people:createContact"
req.Entête["Authorization"]="Bearer "+MonToken.Valeur

j est un JSON

j.addresses[1].streetAddress= "monadresse"
j.addresses[1].city= "maville"
j.addresses[1].postalCode="moncodepostal"
j.addresses[1].type= "work"
j.names[1].familyName="monnom"
j.names[1].givenName= "monprenom"
j.phoneNumbers[1].value="montelephone"
j.phoneNumbers[1].type= "work"
j.phoneNumbers[2].value="monmobile"
j.phoneNumbers[2].type="mobile"
j.emailAddresses[1].value= "monemail.com"
j.emailAddresses[1].type= "work"
req.Contenu=j
réponseHTTP est un httpRéponse = HTTPEnvoie(req)


Merci.
Registered member
29 messages
Popularité : +3 (3 votes)
Posted on October, 14 2019 - 10:20 AM
Bonjour,

Tu as essayé
toto..Scope="contacts" ?