patzly / grocy-android

ERP beyond your fridge, now on your phone – An awesome companion app for grocy
https://patrickzedler.com/grocy/
GNU General Public License v3.0
829 stars 80 forks source link

Feature Request: If AuthFailureError, open browser to allow authentication #829

Open jjgmckenzie opened 5 months ago

jjgmckenzie commented 5 months ago

I have Grocy running behind Authelia, which means I cannot use the app; as I receive an AuthFailureError.

Instead; a browser page could be opened where auth is performed, then the app could function as normal.

I would be happy to investigate making a PR for this if this would be adopted

manuel-rw commented 5 months ago

Also interested in this 👍

dominiczedler commented 4 months ago

Has Authelia some kind of token implementation, so that the app could fetch a token and use it in further connections after that? It's not that easy that you could simple open a browser if there was an AuthFailureError.

benjamin3322 commented 4 months ago

Hello, I'm also interested in this.

I use cloudflare to secure applications that are publicly available.

To secure an application we have multiple possibilities (not exaustive):

The later causes an error:

Erreur : Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
    at org.json.JSON.typeMismatch(JSON.java:112)
    at org.json.JSONObject.<init>(JSONObject.java:172)
    at org.json.JSONObject.<init>(JSONObject.java:185)
    at androidx.camera.view.PreviewView$1$$ExternalSyntheticLambda2.onResponse(R8$$SyntheticClass:18)
    at xyz.zedler.patrick.grocy.helper.DownloadHelper$$ExternalSyntheticLambda11.onResponse(R8$$SyntheticClass:1)
    at xyz.zedler.patrick.grocy.web.CustomStringRequest$$ExternalSyntheticLambda0.onResponse(R8$$SyntheticClass:17)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:11)
    at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:27)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8248)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

I think HomeAssistant handle both cases when connecting with the compagnon app.