Community mailing list archives
community@mail.odoo.com
Browse archives
Re: Odoo to PHP rest api authentication using oauth2
byLook at the oauth2 module which does handle the callback in python. This is not difficult stuff and Google in particular has hundreds of examples as well as good explanations of the different oauth2 flows.
Normally the return payload is just a base 64 encoded JSON dict. Often not even encrypted.
Typically you would use either requests lib or urllib and urllib2 if you enjoy pain. But really it boils down to send request, decode response, and so on until authentication is done, then use the output of that in later requests.
Hi Senthil,
Thats what I said and asked in the beginning, the php does provide the rest api and the auth that needs to be used is oauth2, how can this be implemented in odoo or how can I make a call to the rest api? Using this auth...
On 06-Oct-2016 11:27, "senthilnathan g" <bornspy@gmail.com> wrote:for that php have to provide api and how to access it and so on.that part can be handled easily in python and also can be in odoo with some changes in python code.On Thu, Oct 6, 2016 at 10:12 AM, Yaseen Shareef <mayashkhan@gmail.com> wrote:The php side is implemented using rest api, and the communication I am talking about is from Odoo to php, not vice versa. If it was from php to odoo, I get your point. Do you have any idea about how oauth2 can be implemented for communications from Odoo to the rest api of the php system?mayashkhan@gmail.comThanks And Regards,Yaseen ShareefOdoo Developer/ Consultant
Skype: yaseen.shareef91On Thu, Oct 6, 2016 at 10:03 AM, <bornspy@gmail.com> wrote:There is no need for those things u can jsonrpc or xmlrpc with db,username,password,port(optional).I m curious how come consumer key,etc... Came here 🤔
Sent from my iPhoneI 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 = "https://api.twitter.com/1.1/statuses/home_timeline.json" 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
mayashkhan@gmail.comThanks And Regards,Yaseen ShareefOdoo Developer/ Consultant
Skype: yaseen.shareef91_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe
Reference
-
Odoo to PHP rest api authentication using oauth2
byyasin-
Re: Odoo to PHP rest api authentication using oauth2
byOpen For Small Business Ltd, Graeme Gellatly -
-
-
-
-