Git Product home page Git Product logo

Comments (10)

ouvreboite avatar ouvreboite commented on June 12, 2024

Hello @pytmar .

The o_auth2_token_post endpoint expect the grant type as its third parameter.
And for the moment we only support the type "client_credentials".

Could you try again with this call ?

auth_response = auth_api.o_auth2_token_post(client_id=client.configuration.username,
                                                client_secret=client.configuration.password,
                                                grant_type="client_credentials")

from criteo-python-marketing-sdk.

UmarIgan avatar UmarIgan commented on June 12, 2024

grant_type="client_credentials" : what client_credentials will be here exaclty? as a dict of client_id and client_secret as i wrote above or just one of them if not how and where should i get client_credentials? this is my actual problem i believe because i am not familiar with oauth and i don't understand client_credentials what is i think.

from criteo-python-marketing-sdk.

ouvreboite avatar ouvreboite commented on June 12, 2024

It is literally the string "client_credentials" :)

The grant type is like an enum of the different types of oauth flows. And the only one acceptable for the moment is "client_credentials".

from criteo-python-marketing-sdk.

UmarIgan avatar UmarIgan commented on June 12, 2024

I tried as you said, change the grant_type="client_credentials" but i got the same error above again.

from criteo-python-marketing-sdk.

ouvreboite avatar ouvreboite commented on June 12, 2024

Ok, this line is also problematic: configuration = Configuration(username='mail_address', password='password')
You should put your credentials here.

For example, with this script I'm able to get the token.

import re
import sys
import criteo_marketing as cm
from criteo_marketing import Configuration

configuration = Configuration(username="[email protected]", password="my_super_secret_password")

client = cm.ApiClient(configuration)

auth_api = cm.AuthenticationApi(client)

auth_response = auth_api.o_auth2_token_post(client_id=client.configuration.username,
                                                client_secret=client.configuration.password,
                                                grant_type="client_credentials")
token = auth_response.token_type + " " + auth_response.access_token
print(token)

from criteo-python-marketing-sdk.

UmarIgan avatar UmarIgan commented on June 12, 2024

I tried this with my authorized account's mail and password but it still gives me the same error

from criteo-python-marketing-sdk.

ouvreboite avatar ouvreboite commented on June 12, 2024

If the error is still HTTP response body: {'error': 'invalid_grant', 'error_description': 'The client_id or client_secret is incorrect.', 'token_error': "Cannot refresh token by calling 'https://api.criteo.com/marketing/oauth2/token'"} even with the corrected script it means there is a problem with the actual credentials.

Are you able to connect to https://marketing.criteo.com/ with thoses credentials ?
If your account has been created specifically for API consumption, has it been created with the correct role "Business Manager" ?

cf. https://support.criteo.com/s/article?article=API-Getting-Started&language=en_US

from criteo-python-marketing-sdk.

UmarIgan avatar UmarIgan commented on June 12, 2024

We have 3 account in criteo marketing: Administrator, Financial Manager and Technical Manager. The credentials are belongs to Administrator. In user section there is no Business Manager role but when i create API Users - REST API i define the role of Administrator as Business Manager, is this could be the problem? should i have a Business Manager role in the user section?

from criteo-python-marketing-sdk.

ouvreboite avatar ouvreboite commented on June 12, 2024

The account problems are handled by the support.
Could you please contact your account strategist or contact [email protected] ?

from criteo-python-marketing-sdk.

UmarIgan avatar UmarIgan commented on June 12, 2024

The account problems are handled by the support.
Could you please contact your account strategist or contact [email protected] ?

solved by support team, thank you.

from criteo-python-marketing-sdk.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.