Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm getting a 401 error when I try to authenticate the integration #5

Closed
TomCasavant opened this issue Jun 30, 2022 · 4 comments
Closed
Assignees
Labels
help wanted Extra attention is needed

Comments

@TomCasavant
Copy link

This may just be an issue w/ a security policy setup on my work account, but I'm getting this error

  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 196, in get
    return await super().get(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 95, in get
    result = await self._flow_mgr.async_configure(flow_id)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 300, in async_step_creation
    token = await self.flow_impl.async_resolve_external_data(self.external_data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 169, in async_resolve_external_data
    return await self._token_request(
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 205, in _token_request
    resp.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://login.microsoftonline.com/common/oauth2/v2.0/token')
@geoffreylagaisse
Copy link
Owner

Hi sorry I was on holiday with no access to email.
Can I have a bit more information?
Version of HA? using reverse proxy? Does home assistant run with an SSL certificate?

@geoffreylagaisse geoffreylagaisse self-assigned this Jul 5, 2022
@geoffreylagaisse geoffreylagaisse added the help wanted Extra attention is needed label Jul 5, 2022
@RobSheppard1976
Copy link

@TomCasavant - I was running into this too. I was trying out a different integration, and in the logs for that one, it stated:

"Unable to fetch auth token. Error: (invalid_client) AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID"

So I went and made sure I was using the correct secret value and that integration worked. So I then came back to this one, and made sure to use the correct value (I wasn't previously), and now it's connecting just fine.

@theovencook
Copy link

theovencook commented Aug 11, 2022

401 is generic when you get the Client ID/ Secret wrong (and probably other stuff..)

For me, when creating the secret within Certificates & Secrets >
You need to copy the key, not the the Secret ID

@ayed3
Copy link

ayed3 commented Aug 16, 2022

this is exactly was my issue, taking secret ID instead of KEY , now it is working

401 is generic when you get the Client ID/ Secret wrong (and probably other stuff..)

For me, when creating the secret within Certificates & Secrets > You need to copy the key, not the the Secret ID

this is exactly was my issue, taking secret ID instead of KEY , now it is working
thanks a lot , you made my day , now I can show off using this integration and have light in in my home office that indicates my busy status so no one can bother me :):)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants