PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → Contact Google via l'API People
Contact Google via l'API People
Iniciado por christophe, out., 08 2019 6:21 PM - 1 resposta
Publicado em outubro, 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.
Membro registado
29 mensagems
Popularité : +3 (3 votes)
Publicado em outubro, 14 2019 - 10:20 AM
Bonjour,

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