Skip to content

is that possible to use other token than those from twitchtokengenerator.com ? #407

@loupzeur

Description

@loupzeur

I created a token usinig the following code :

def token(): load_dotenv() url = 'https://id.twitch.tv/oauth2/token' form_data = { 'client_id': os.getenv('TWITCH_CLIENT'), 'client_secret':os.getenv('TWITCH_SECRET'), 'grant_type':'client_credentials', 'scope': ' '.join(['chat:read','chat:edit']) } server = requests.post(url, data=form_data) ret = server.json()['access_token'] return ret

with the code given as example :

`class Bot(commands.Bot):

def __init__(self):
    # Initialise our Bot with our access token, prefix and a list of channels to join on boot...
    super().__init__(token=token(), prefix='?', initial_channels=['...'])

async def event_ready(self):
    # We are logged in and ready to chat and use commands...
    print(f'Logged in as | {self.nick}')
    print(f'User id is | {self.user_id}')

@commands.command()
async def hello(self, ctx: commands.Context):
    # Send a hello back!
    await ctx.send(f'Hello {ctx.author.name}!')`

I simply can't get the code running, it seems the token doesn't have the proper right, but when using a token generated from twitchtokengenerator.com it works .... what scope am I missing ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions