Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo 17 Microsoft SSO oauth Integration

Subscriure's

Get notified when there's activity on this post

This question has been flagged
oauthssomicrosoftoauth2Controller
4034 Vistes
Avatar
Abhinav Bajimaya


I am trying to integrate microsoft azure with Odoo. I think all the keys through the azure portal is configured correctly.  "client id and client secret"

Ive managed to get the sign-in with Microsoft button on the login page. On clicking it, the page is redirected to '/authorize' page where you enter the username and password. 

Microsoft then redirects to this link GET on /microsoft_sso_integration/microsoft?code=something&state="something", which is all good according to the docs.

The problem is that  the query parameters here are not accessible through the *kw args. 
I try to check the kw value, but it returns empty when clearly it should be the code and state value returned by Microsoft.

This breaks the entire login flow of the code and I cant seem to figure out whats wrong here.

here is the auth controller 

class MicrosoftRoute(http.Controller):

  •     @http.route('/microsoft_sso_integration/microsoft', type='http', auth='none')
  •     @fragment_to_query_string    
  •     def azure_return(self, **kw):   
  •         state = json.loads(kw['state'])
  •         # make sure request.session.db and state['d'] are the same,
  •         # update the session and retry the request otherwise
  •         dbname = state['d']
  •         if not http.db_filter([dbname]):
  •             return BadRequest()
  •         ensure_db(db=dbname)

  •         provider = state['p']
  •         request.update_context(**clean_context(state.get('c', {})))
  •         _logger.info('outside try block')
  •         try:
  •             # auth_oauth may create a new user, the commit makes it
  •             # visible to authenticate()'s own transaction below
  •             _, login, key = request.env['res.users'].with_user(SUPERUSER_ID).auth_oauth_microsoft(provider, kw)
  •             _logger.info(str(login) + ' ' + str(key) + ' ' + str(dbname))
  •             request.env.cr.commit()
  •             action = state.get('a')
  •             menu = state.get('m')
  •             
  •             redirect = werkzeug.urls.url_unquote_plus(state['r']) if state.get('r') else False
  •             url = '/web'
  •             if redirect:
  •                 url = redirect
  •             elif action:
  •                 url = '/web#action=%s' % action
  •             elif menu:
  •                 url = '/web#menu_id=%s' % menu
  •             _logger.info(str(dbname) + ' ' + str(login) + ' ' + str(key))
  •             pre_uid = request.session.authenticate(dbname, login, key)
  •             resp = request.redirect(_get_login_redirect_url(pre_uid, url), 303)
  •             resp.autocorrect_location_header = False

  •              # Since /web is hardcoded, verify user has right to land on it
  •             if werkzeug.urls.url_parse(resp.location).path == '/web' and not request.env.user._is_internal():
  •                 resp.location = '/'
  •             return resp
  •         except AttributeError:
  •             # auth_signup is not installed
  •             _logger.error("auth_signup not installed on database %s: oauth sign up cancelled." % (dbname,))
  •             url = "/web/login?oauth_error=1"
  •         except AccessDenied:
  •             # oauth credentials not valid, user could be on a temporary session
  •             _logger.info('OAuth2: access denied, redirect to main page in case a valid session exists, without setting cookies')
  •             url = "/web/login?oauth_error=3"
  •             redirect = werkzeug.utils.redirect(url, 303)
  •             redirect.autocorrect_location_header = False
  •             return redirect
  •         except Exception:
  •             # signup error
  •             _logger.exception("Exception during request handling")
  •             url = "/web/login?oauth_error=2"

  •         redirect = request.redirect(url, 303)
  •         redirect.autocorrect_location_header = False
  •         return redirect

      
0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
automatically create user for users logging in via single sign on
oauth sso oauth2 Oauth SSO
Avatar
0
de jul. 24
2779
Odoo OAuth (Lark SSO): How to Support Multiple Browser Logins Without Session Conflict?
development oauth sso
Avatar
0
de juny 25
1220
Google oauth
oauth oauth2 googlelogin
Avatar
0
de des. 23
2365
Unable to install "OAuth2 Authentication" addon - Parse error? Field "in_group_14" does not exist in model "res.users"?
authentication sso oauth2
Avatar
0
d’oct. 21
4211
OAuth with OpenAM (SSO)
oauth sso OpenAm
Avatar
Avatar
2
de març 15
3796
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now