BingAds / BingAds-Python-SDK

Other
117 stars 162 forks source link

Passing in client_secret ? #134

Closed ibrierley closed 5 years ago

ibrierley commented 5 years ago

Hi, I'm just trying to get bingads api working.

One oddity I can't follow, is that I can't figure out how to pass in client_secret from my script.

I can hack it directly, by adding the line

self._client_secret = 'blahblah' inside class OAuthWithAuthorizationCode(OAuthAuthorization): init

And then it works, but naturally I assume there's a better way ?

If it makes any difference, I've had to go down the route of manual authentication, as I'm running this on a Linux server, which tries to use elinks with no javascript support, so as a one off I've had to authenticate by copy/pasting from browser.

Thanks!

eric-urban commented 5 years ago

@ibrierley please use OAuthWebAuthCodeGrant if you have a client secret. Please see Using OAuth for more details.

ibrierley commented 5 years ago

Ok, I think thats got me out of the hack :)....

So rather than using

authentication=OAuthDesktopMobileAuthCodeGrant( ...

I'm using


    authentication=OAuthWebAuthCodeGrant(
        client_id=CLIENT_ID,
        client_secret=CLIENT_SECRET, 
        redirection_uri="someuri",
        env=ENVIRONMENT
    )```
ibrierley commented 5 years ago

Many thanks