Skip to Content
Menu
This question has been flagged
2 Replies
2610 Views

I want to create an odoo controller and be able to use it without the need of authentication. Can anyone help ?

Avatar
Discard
Best Answer

Hi Redi,

In route give auth='public' , 
Public authentication. Anyone can access.


Refer,

https://www.odoo.com/forum/help-1/what-is-the-use-of-auth-public-parameter-in-http-route-84696

https://www.youtube.com/watch?v=8395q9DYHfg

Avatar
Discard

Hello , but still need to know after i've done this and then i return a result , how can i call and use this result on other model without using parameters of 1 specifc database

Best Answer


by using auth=public.

class MyController(odoo.http.Controller):
    @route('/some_url', auth='public')
    def handler(self):
        return stuff()


Please find more details on odoo website document with below link.

https://www.odoo.com/documentation/14.0/developer/reference/addons/http.html

Avatar
Discard
Author

When i used authentication i took the returned data from the controller like this:

session = requests.Session()
r = session.post(url=url_connect, data=json.dumps(data_connect), headers=headers)
if r.ok:
session_id = r.headers['Set-Cookie'].split(';')[0].replace('session_id=', '')
if session_id:
session.cookies['session_id'] = session_id
r = session.get(url=url, data=json.dumps(data), headers=headers)
result = r.json()['result']

,including the database params and the urls.

How can i take the returned data from controller in my case now ?

Related Posts Replies Views Activity
1
Dec 23
1002
2
Aug 23
934
1
Dec 23
2077
1
Jul 23
1522
0
May 23
1286