mattantonelli / lodestone

Unofficial webhook service, REST API, and RSS feed for Final Fantasy XIV Lodestone news
https://lodestonenews.com
30 stars 8 forks source link

Failed to subscribe - 401 Unauthorized #5

Closed Shuro closed 6 years ago

Shuro commented 6 years ago

Hi Mattantonelli,

I have problems to successfully add the bot to my discord server:

cat log/development.log E, [2018-08-21T14:54:08.473093 #1] ERROR -- : Failed to subscribe - 401 Unauthorized 123.123.123.123 - - [21/Aug/2018:14:54:08 +0000] "GET /authorize?state=101101&code=[RemovedByMe] HTTP/1.1" 200 4931 0.5046

I copied the webhooks.ym.example and modified it like so:

client_id:     'ClientIdNumber'
client_secret: 'TheSecretSecret'
redirect_uri:  'https://lodestone.shuro.de'

First two values from https://discordapp.com/developers/applications/, last value is the NGINX address which redirects to the local port of your script.

On the Discordapp site I've first configured the Oauth2 redirect url to https://lodestone.shuro.de, but this didn't work at all. After looking into your code, I've tried https://lodestone.shuro.de/authorize, which comes further, but the above failure happens.

Did I do something wrong while setting up the bot?

mattantonelli commented 6 years ago

It looks like you're headed in the right direction. You definitely need to add the authorize route to the URI as you have done with https://lodestone.shuro.de/authorize. It's also important that the URI in both your Discord app OAuth settings and the URI in your configuration are identical. It sounds like you've updated it in the app but not in your configuration file. Can you double check that for me?

Thank you for bringing it to my attention that the example URI is missing the /authorize. This is something I need to fix.

Shuro commented 6 years ago

Thank you, that fixed it! Hadn't modified the URL in the config-file.