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

Login information entered in settings does not translate to OH3 login #2339

Open
joshuakoh1 opened this issue Dec 19, 2020 · 4 comments
Open
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@joshuakoh1
Copy link

Actual behaviour

Describe us what happens

The username/password in the settings only functions in authenticating with the cloud connector, user still needs to login via the OH3 page before being presented with paper UI administration

Expected behaviour

Describe us what should happen

Login information in settings should function as auth headers for OH3 admin

Steps to reproduce

  1. Enter login information in app settings
  2. Click on OH3 UI
  3. Not authenticated

Can you reproduce the issue in demo mode?

Environment data

Client

  • Android version:
  • Device model:
  • App version :
  • Build flavor :
  • Device language:

Server

  • Server version:
  • Reverse Proxy:
  • Authentication method :

openHAB Cloud

  • Self hosted cloud or myopenhab.org:
  • openHAB Cloud version :
  • Authentication method :

Logs

App log

Click to expand
Please add the app log if the issue is not a pure UI issue or it cannot be reproduced in demo mode.
Open the app, go to `Settings` => `View log` and insert the log here.

openHAB Server log

Click to expand
Not required.
If you have installed openHAB via `apt-get`, the log is located under `/var/log/openhab2/openhab.log`
@joshuakoh1 joshuakoh1 added the bug Indicates an unexpected problem or unintended behavior label Dec 19, 2020
@mueller-ma
Copy link
Member

@ghys Do you think some kind of api could resolve this issue? The app could pass the credentials for basic auth to the UI.

@tjach
Copy link

tjach commented Jan 3, 2021

Same problem here. I've been strugling with Nginx and/or Auth in OH3 and got to a point, where android app is not working whatever I do.

Nginx is configured to stop on basic auth for everyone outside local network.

Cases:

  1. My phone is is connected via wifi to the local network. No username/password is needed. Android application works just fine.
  2. My phone is on cellular network. Via browser I am able to go to my openhab address and am presented with basic auth prompt. After submitting username/password (from nginx) I can see the OH3 welcome page (user is not logged in). Via android app, nginx registers the login attempt:
    37.47.122.253 - - [03/Jan/2021:15:37:05 +0100] "GET /rest/ HTTP/1.1" 401 188 "-" "openHAB client for Android" but fails to log-in

Nginx config is supplied with:

        add_header Set-Cookie X-OPENHAB-AUTH-HEADER=1;
        proxy_set_header Authorization "";

@lsafelix75
Copy link

I have similar requirement. After digging into MainUI's code, IOS/Androud do not have jsinterface to pass credentials into MainUI to perform login. For my case, I prefer using API Token to login in instead of username/password. Hence, i have created the following PR but unfortunately it doesn't create much traction.

openhab/openhab-core#3815

There is another related PR which i have not opened yet because i don't see much response from experts. This idea is mentioned here: https://community.openhab.org/t/x-openhab-token-use-for-mainui-authentication/149548)

Combine the above PRs and existing unused codes in MainUI to extract credentials from IOS/Android, i believe only then we can see the "SSO" :)

window.OHApp.getBasicCredentialsUsername
window.OHApp.getBasicCredentialsPassword

@mueller-ma
Copy link
Member

Combine the above PRs and existing unused codes in MainUI

Does MainUI already implement the JS interface getBasicCredentialsUsername?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants