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

StatusCode 401 #25

Open
manshurtigh opened this issue Jul 27, 2023 · 17 comments
Open

StatusCode 401 #25

manshurtigh opened this issue Jul 27, 2023 · 17 comments

Comments

@manshurtigh
Copy link

manshurtigh commented Jul 27, 2023

Hi!

It seems to me that I cannot connect to Västtrafik. I was wondering if anyone has seen this problem before? See logs belows.

[27.07.2023 17:55.31.923] [LOG]   5:55:31 PM MMM-Vasttrafik-PublicTransport: generateAccessToken failed =StatusCodeError: 401 - ""
[27.07.2023 17:55.31.932] [WARN]  Unhandled rejection ReferenceError: reject is not defined
    at /opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_helper.js:78:11
    at tryCatcher (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:102:5)
    at Async.drainQueues [as _onImmediate] (/opt/magic_mirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:15:14)
    at process.processImmediate (node:internal/timers:476:21)

401 indicates that I have an authorization issue, but I can't figure out what's wrong. I've checked the APIs that the application is subscribed to. See below image.

2023-07-27 18_06_58-Västtrafik - Developer portal - My applications

I am using ClientID as "appKey" and Secret as "appSecret".

appKey: "yyyyyy",
appSecret: "xxxxxxxxxx",

Am I doing something wrong?

@Xkhi
Copy link

Xkhi commented Aug 3, 2023

I had similar issues with this module, what I noticed is that it relies on v2 of Västtrafik's API, I made a fork to update it to v4 and merge some other forks to support multi-filtering. Feel free to check the other forks
https://github.com/bureus/MMM-Vasttrafik-PublicTransport/network/members

@manshurtigh
Copy link
Author

Yeah, I saw that this one relies on v2 as well and I thought it had something to do with that as well.

Thank you for creating a fork and updating it to v4. I actually started to use MMM-ResRobot instead in the mean time. I will try your fork.

@manshurtigh
Copy link
Author

Your fork worked perfectly! Thank you so much @Xkhi.

I suggest that you actually put this up as a separate "version 2" or something similar on the 3rd module pages here on Github so more people can find this.

I leave this comment open so more people may find it since the authentication is a crucial part of the module to work. Again, thank you so much @Xkhi.

@Xkhi
Copy link

Xkhi commented Aug 3, 2023

I thought of doing that, but it felt wrong... but now that you suggest it, I'll do it. Thanks for the encouragement.

@manshurtigh
Copy link
Author

Do it! I don't think @bureus supports this module anymore.

@manshurtigh
Copy link
Author

@Xkhi Could you add me on Discord? My name is snåm#8165. I have some more ideas for this module, if you are interested.

@Xkhi
Copy link

Xkhi commented Aug 4, 2023

I don't use discord that much, but sure, we can discuss in private

@Bagronk
Copy link

Bagronk commented Oct 5, 2023

Hi, I just thought I'd check with you. The only thing that shows up on my MagicMirror is the Västtrafik logo. What could be wrong? I setup a mirror in 2018 or something and that has worked until now when the SD-card in the Pi died, and I can't find the backup. So now I have a Linux Mint based Mirror. I got the API to the weather module to work but not this one.

@Xkhi
Copy link

Xkhi commented Oct 5, 2023

this library is super outdated, I would recommend to use one of the forks that stem from it

@Bagronk
Copy link

Bagronk commented Oct 5, 2023

Oh, I am. I was just a bit tired and commented here. I'm using your fork.

@kallby86
Copy link

I also only get the Västtrafik Logo and i have updated to your fork? @Bagronk did you get it to work?

@Bagronk
Copy link

Bagronk commented Jan 21, 2024

I got it working, and it is working. But I can't remember what I did. It does however give me errors in the terminal when running the mirror.

Are you using xkhi's fork?

@Bagronk
Copy link

Bagronk commented Jan 21, 2024

Actually! Check the brackets one by one. I have a vague memory of something being off with the brackets.

@kallby86
Copy link

Yes i am using xkhi's fork. Then i have alot of work to do, i am not a programmer either so i don't understand the brackets very well

@kallby86
Copy link

[23.01.2024 00:03.58.287] [LOG] 00:03:58 MMM-Vasttrafik-PublicTransport: generateAccessToken failed =StatusCodeError: 401 - "{"error_description":"Client Authentication failed.","error":"invalid_client"}"
[23.01.2024 00:03.58.304] [WARN] Unhandled rejection ReferenceError: reject is not defined
at /home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_helper.js:78:11
at tryCatcher (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/MagicMirror/modules/MMM-Vasttrafik-PublicTransport/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)

@Bagronk
Copy link

Bagronk commented Jan 23, 2024 via email

@Xkhi
Copy link

Xkhi commented Jan 25, 2024

Hi guys, I have enabled issues in my fork, you can go ahead and move the conversation there

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

4 participants