Community mailing list archives

Odoo to PHP rest api authentication using oauth2

- 10/06/2016 00:10:01

I am trying to implement a connection from Odoo to a php server which has a rest api, and at the php side, the oauth2 authentication is what is being used. So how can I do this from python, is there anyway to skip the callback uri step? I checked out a few steps, and the following is an example I found:

import oauth2 as oauth
import json

CONSUMER_KEY = "your app's consumer key"
CONSUMER_SECRET = "your app's consumer secret"
ACCESS_KEY = "your access token"
ACCESS_SECRET = "your access token secret"

consumer = oauth.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET)
access_token = oauth.Token(key=ACCESS_KEY, secret=ACCESS_SECRET)
client = oauth.Client(consumer, access_token)

timeline_endpoint = ""
response, data = client.request(timeline_endpoint)

tweets = json.loads(data)
for tweet in tweets:
    print tweet['text']

But, its clearly not mentioned or recognizable as to how this would work in the Odoo scene of things, I mean what would be the consumer key and consumer secret in Odoo's case, and what about the access key and access secret. I really would like some insight from someone who has implemented something similar in Odoo. The end purpose is actually to create a user in the php system whenever a user is created in Odoo. I hope someone can answer this

Thanks And Regards,
Yaseen Shareef

Odoo Developer/ Consultant
Skype: yaseen.shareef91