Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Server Error 500 after Auth #29

Closed
jochke opened this issue May 1, 2020 · 4 comments
Closed

Server Error 500 after Auth #29

jochke opened this issue May 1, 2020 · 4 comments

Comments

@jochke
Copy link

jochke commented May 1, 2020

After installation it says I AUTHORIZED SUCCESSFULLY and I click the Link Microsoft To Do account.
In a new window microsoft authentification appears and I return to my HA Servers URL https://[YOUR HOME ASSISTANT URL:PORT]/api/microsoft-todo?code=M57ca82ef-3f6b-15e7-cebc-c1113d8ccee2&state=jHbj90TAlDJRylAPPbU6z6uDbquF95 with the following error message:

500 Internal Server Error
Server got itself in trouble

The error log shows the following:

Log Details (ERROR)
Logger: aiohttp.server
Source: custom_components/microsoft_todo/calendar.py:171
First occurred: 9:57:16 AM (1 occurrences)
Last logged: 9:57:16 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 120, in handle
    result = handler(request, **request.match_info)
  File "/config/custom_components/microsoft_todo/calendar.py", line 171, in get
    code=data.get("code")
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 307, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) AADSTS50194: Application '896612c0-2d90-48f2-9293-eac27fd19aed'(Home Assistant) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
Trace ID: 969e2502-0d1a-4370-8578-d9859b4e4400
Correlation ID: a67b4821-b646-48a4-b535-4af72309a9e5
Timestamp: 2020-05-01 07:57:16Z
@drletai
Copy link

drletai commented May 2, 2020

The very same here... Neither localhost nor Domain.

@black-roland
Copy link
Owner

Oh, thanks for the reporting. It seems the registration UI changed so instructions in README are out of date.

@jochke @drletai Could you try to register a new app in Azure and select "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)" on the registration form?

Selection_999(1094)

@drletai
Copy link

drletai commented May 2, 2020

Thanks, that do the trick... but I did not created a new application, but modified the registry, that azure and personal also would accept
Great

@jochke
Copy link
Author

jochke commented May 2, 2020

Instead of creating a new app I just changed the Manifest JSON from "signInAudience": "PersonalMicrosoftAccount"
to
"signInAudience": "AzureADandPersonalMicrosoftAccount"

Then it seems to work. I got the following message from my HA:

Microsoft To Do has been successfully authorized! You can close this window now!

Thank you for fast response and keep up the good work. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants