Detecting expired oauth token during connection to IRC

Is there a reliable/official way to detect an expired oauth token when connecting to the IRC server? I do not see any documentation about this in the Twitch API documentation. For web requests it’s easy because we get back a 4xx response with a WWW-Authenticate header in such cases. How do we handle this for IRC?

I usually make a call to

With the oAuth in the header to confirm the User ID and Username.

Just in case I changed the Username of the bot, so I can join the right channels.

Works a little better than trying to connect to IRC and getting the Invalid Password response

I’d like to avoid having to make an additional web API call just to check, plus going that route could introduce a race condition, at which point I arrive back at the same problem.

Then the only way to see if the token is still valid is to try it.

If it’s wrong you’ll get a standard IRC “password is invalid” response.

iirc the wording is more along the lines of “unsuccessful login”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.