#Help with custom authentication setup

7 messages · Page 1 of 1 (latest)

sleek sandal
#

I am developing a new integration for a client. We have already implemented authorization as suggested in the documentation (https://developers.home-assistant.io/docs/config_entries_config_flow_handler#configuration-via-oauth2), and I'm able to link Home Assistant with our authorization provider by providing a client ID and secret, after which we are redirected to the auth provider to login. This is all functioning correctly. However, rather than being redirected out of HomeAssistant, our client would prefer that we use a Secure Remote Password flow, i.e. provide the username and (hashed) password via Home Assistant directly to the provider.

I have been trying to figure out how to provide this custom authentication. I think I've understood that I need to set up a custom Config Flow, per the documentation found here: https://developers.home-assistant.io/docs/config_entries_config_flow_handler. However, I'm not sure how to invoke this custom flow instead of the current Application Credentials flow when the user adds our integration. I can see how I would add a custom OAuth implementation (e.g. https://developers.home-assistant.io/docs/core/platform/application_credentials#custom-oauth2-implementations), but not how that related to the custom Config Flow. If you can point me in the right direction that would be very appreciated!

Integrations can be set up via the user interface by adding support for a config flow to create a config entry. Components that want to support config entries will need to define a Config Flow Handler. This handler will manage the creation of entries from user input, discovery or other sources (like Home Assistant OS).

Integrations may support Configuration via OAuth2 allowing

vast kestrel
#

Secondly I would stick with standards if you can

#

If you sign in using username and password that got nothing to do with the OAuth

#

The only things the Config Flow would do then is pass username and password to your library

#

And the library hashes the password sends it

#

And for username/email pass in config flows you should find plenty examples in core