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

Problem with authorizing #26

Open
swissmaster1 opened this issue Apr 13, 2020 · 27 comments
Open

Problem with authorizing #26

swissmaster1 opened this issue Apr 13, 2020 · 27 comments

Comments

@swissmaster1
Copy link

swissmaster1 commented Apr 13, 2020

Hi
Is this still working properly? I get this error in the log file:
{"error": {"message": "Unauthorized", "code": 401, "type": "Http401"}}

But when I copy paste the login data from my default.yaml to https://my.gigaset-elements.com I can login on the page. Did Siemens Gigaset maybe change something?

@ycardon
Copy link
Owner

ycardon commented Apr 14, 2020

It still works on my setup.

  • is it your first install or it did stop working ?
  • do you have some quotes ' in you password ?

@ycardon
Copy link
Owner

ycardon commented Apr 14, 2020

I've looked closely in my logs, I do sometimes have the same message

[Tue Apr 14 2020 17:18:15] [ERROR]  check events | gigaset response:{"error": {"message": "Unauthorized", "code": 401, "type": "Http401"}}
[Tue Apr 14 2020 17:18:15] [INFO]   authorize on gigaset cloud api : starting
[Tue Apr 14 2020 17:18:15] [INFO]   authorize on gigaset cloud api : done

But it is followed by a successful reconnection: the code is handling these connections problems and perform reconnect. It happen sometimes that the current connexion gets invalid, I've got no clue why it happens.

If it's the same for you (and everything is working), you can ignore the message or try to lower the re-auth interval.

# re-authentication interval in minutes
auth_interval: 10

@swissmaster1
Copy link
Author

It still works on my setup.

  • is it your first install or it did stop working ?
  • do you have some quotes ' in you password ?

Yes it is my first install. And I don't have quotes in my password, only normal letters.

@swissmaster1
Copy link
Author

swissmaster1 commented Apr 15, 2020

This is what the log says:
[ERROR] check events | gigaset response:{"error": {"message": "Unauthorized", "code": 401, "type": "Http401"}} [INFO] authorize on gigaset cloud api : starting [INFO] authorize on gigaset cloud api : done [ERROR] check events | unexpected error: TypeError: Cannot read property 'reverse' of undefined

On what port are the requests made? Could that be a problem of port forwarding may be?

@ycardon
Copy link
Owner

ycardon commented Apr 16, 2020

Sorry for the lag in the answers.

Some questions about your setup:

  • do you use gigaset-proxy it as an Hassio addon or as a plain node application ?
  • in the second option, what version of node do you use ? can you upgrade ? mine is v13.12
  • do you have prior messages in the log ? normal starting messages should be
[Thu Apr 16 2020 23:11:15] [INFO]   gigaset-element-proxy v2.2.6 is starting
[Thu Apr 16 2020 23:11:15] [INFO]   authorize on gigaset cloud api : starting
[Thu Apr 16 2020 23:11:15] [INFO]   mqtt connected
[Thu Apr 16 2020 23:11:16] [INFO]   authorize on gigaset cloud api : done
[Thu Apr 16 2020 23:11:16] [INFO]   server listening on http://localhost:8094

@ycardon
Copy link
Owner

ycardon commented Apr 16, 2020

These are the URLs that are requested, they are https requests (port 443)

export enum GIGASET_URL {
LOGIN = 'https://im.gigaset-elements.de/identity/api/v1/user/login',
BASE = 'https://api.gigaset-elements.de',
AUTH = 'https://api.gigaset-elements.de/api/v1/auth/openid/begin?op=gigaset',
EVENTS = 'https://api.gigaset-elements.de/api/v2/me/events?from_ts=',
CAMERA = 'https://api.gigaset-elements.de/api/v1/me/cameras/{id}/liveview/start',
SENSORS = 'https://api.gigaset-elements.de/api/v1/me/basestations'
}

There is a manual way to debug connectivity, you can try to curl the URLs from your server as @ginkel and I did here

@ycardon
Copy link
Owner

ycardon commented Apr 16, 2020

Last thing: I've pushed some changes 2 days ago on this repo, please git pull && npm run build to make sure you have the latest version.

@swissmaster1
Copy link
Author

Hi ycardon
Thanks for answer. I'm using it as a docker image (tgbyte-gigaset-elements-proxy). For this reason I cant git pull && npm run build (or to tell the truth I dont have an idea how to do it.)

This are the prior messages in the log:

[Sat Apr 18 2020 20:56:24] [ERROR]  check events | gigaset response:{"error": {"message": "Unauthorized", "code": 401, "type": "Http401"}}
[Sat Apr 18 2020 20:56:24] [INFO]   authorize on gigaset cloud api : starting 
[Sat Apr 18 2020 20:56:24] [INFO]   authorize on gigaset cloud api : done
[Sat Apr 18 2020 20:56:44] [INFO]   gigaset-element-proxy v2.2.2 is starting
[Sat Apr 18 2020 20:56:44] [INFO]   authorize on gigaset cloud api : starting
[Sat Apr 18 2020 20:56:44] [INFO]   mqtt connected
[Sat Apr 18 2020 20:56:45] [INFO]   authorize on gigaset cloud api : done
[Sat Apr 18 2020 20:56:45] [INFO]   server listening on http://localhost:3000
[Sat Apr 18 2020 20:56:45] [ERROR]  sensor actual status | unexpected error: TypeError: Cannot read property 'sensors' of undefined

@ycardon
Copy link
Owner

ycardon commented Apr 19, 2020

Woa nice, someone (it seems to be @ginkel) has posted a docker image !

Well, the docker image is a little outdated (2 months ago) and I will have trouble to help you as I don't know how the image is created. Maybe @ginkel can PR his Dockerfile.

Otherwise, I also maintain a Dockerfile in here but it's specialised for a Hass.io environment.

@ginkel
Copy link
Contributor

ginkel commented Apr 19, 2020

The Docker image build is somewhat proprietary due to the way I am building the image in GitLab CI to build a multiarch image (that also supports arm, which I need to deploy on a Raspberry Pi).

I can certainly contribute the Dockerfile, though.

@swissmaster1
Copy link
Author

That would be nice! I'll try that.

@ycardon
Copy link
Owner

ycardon commented Apr 21, 2020

Hi ycardon
Thanks for answer. I'm using it as a docker image (tgbyte-gigaset-elements-proxy). For this reason I cant git pull && npm run build (or to tell the truth I dont have an idea how to do it.)

What platform are you running on ? A RPi with Raspbian or more generally a linux environment ?

If so, instead of using a docker image, you can go through the options 2 or 3 of the README.md to install the project.

@ycardon
Copy link
Owner

ycardon commented Apr 21, 2020

The Docker image build is somewhat proprietary due to the way I am building the image in GitLab CI to build a multiarch image (that also supports arm, which I need to deploy on a Raspberry Pi).

I can certainly contribute the Dockerfile, though.

Juste wondering: @ginkel did you documented the way to launch your Docker image ? Maybe @swissmaster1 did not correctly referenced his configuration file and is using a default config (without his credentials) inside the image.

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

I am deploying though Ansible, but with a very similar syntax to Docker Compose.

- name: deploy gigaset-elements-proxy container
  include_role:
    name: docker/container
  vars:
    docker:
      image: tgbyte/gigaset-elements-proxy
      name: gigaset-elements-proxy
      init: yes
      memory: 128MB
      networks:
        - bridge
        - ha
        - mqtt
        - web
      state: "{{ docker_container_state }}"
      volumes:
        - /srv/gigaset-elements-proxy/config:/config

@swissmaster1
Copy link
Author

swissmaster1 commented Apr 21, 2020

What platform are you running on ?

I run it on my Synology Diskstation (Unix) with Intel CPU.

Maybe @swissmaster1 did not correctly referenced his configuration file and is using a default config (without his credentials) inside the image.

I tested it and I‘m sure it‘s working with my configuration file and not default.

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

Raspberry Pi / Raspbian

Regarding config: You need to have the default.yaml file mounted at /config/default.yaml.

Just another thought: IIRC the Gigaset Elements API is picky about special characters in the password. Try one that contains only numbers and plain letters.

@swissmaster1
Copy link
Author

I thought docker images run on any plattform. Isn‘t that correct?

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

I thought docker images run on any plattform. Isn‘t that correct?

Nope. tgbyte/gigaset-elements-proxy is a so-called multiarch image that supports amd64 and armv7, though.

@swissmaster1
Copy link
Author

Oh so no chance to run that on my Synology. Thanks guys for answers.

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

Oh so no chance to run that on my Synology. Thanks guys for answers.

No, amd64 is the instruction set supported by most modern Intel CPUs. ;-)

@swissmaster1
Copy link
Author

swissmaster1 commented Apr 21, 2020

But why does it run generally (only authetification error) and doesn‘t give me a runtime error as soon as I start it when my CPU doesn‘t support the instruction set?

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

Your CPU does support the amd64 instruction set.

@swissmaster1
Copy link
Author

swissmaster1 commented Apr 21, 2020

Hmm, now I do not understand anything. When the docker image supports amd64 and my CPU as well, then it should run properly, not?

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

Well, yes and no. The software runs, but it is getting an authentication error from the GE API.

@swissmaster1
Copy link
Author

swissmaster1 commented Apr 21, 2020

And the reason for that is the hardware?

@ginkel
Copy link
Contributor

ginkel commented Apr 21, 2020

Nope. ;-) You need to figure out why your authentication request is rejected by the server.

@swissmaster1
Copy link
Author

Alright! Now I understood. I think there is something with the ports inside docker. I only assigned port 3000 coming from outside docker to go on port 3000 inside docker.

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

No branches or pull requests

3 participants