Get token without having to log in

I’m trying to add a function to my discord bot that would sniff for @admin message in a specific hub so we can easily get notified when users need help, but to do that i need a token and therefore looking for a way to get a token without having to go through the login oauth2.

https://api.faceit.com/auth/v1/oauth/token?grant_type=client_credentials
with base64 key in header give this error

“error”: “invalid_client”,
“error_description”: “Unauthorized grant type: client_credentials”

So i’m stuck… Any ideas?

Hi Ullizzzz,
client_credentials grant type is not available for that client, that’s why you are getting that error.
You can’t get a token for the chat-api without a user login, cause the tokens required for the chat-api are tokens on behalf of the user.
That is needed cause, as you can understand, there are different permissions for every chat room. Match’s rooms are available only for players that are playing the match, team’s rooms are only for the members of the team. A client_credential grant (which is not on behalf of a user, but is mean to be used for services) makes no sense in this scenario.

Btw, I can see your needs and what I suggest you is to create a client with authorization_code flow, authorize it once (login and approve the client) and then use the token & refresh_token in your application to have a persistent authentication, cause the refresh_token allows you to refresh the access token without user interaction.

Hope this can help you
Cheers
Lorenzo