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

Unsupported Grant Type #9

Open
TomCasavant opened this issue Dec 5, 2024 · 0 comments
Open

Unsupported Grant Type #9

TomCasavant opened this issue Dec 5, 2024 · 0 comments

Comments

@TomCasavant
Copy link

TomCasavant commented Dec 5, 2024

Mastodon v4.4 dropped support for authentication via password #387

mastodon.errors.MastodonAPIError: ('Mastodon API returned error', 400, 'Bad Request', 'unsupported_grant_type')

The fix is to use an API access token in

hype/hype/hype.py

Lines 22 to 28 in 422caf8

def login(self):
self.client = self.init_client(self.config.bot_account.server)
self.log.info(f"Logging in to {self.config.bot_account.server}")
self.client.log_in(
self.config.bot_account.email,
self.config.bot_account.password,
to_file=f"secrets/{self.config.bot_account.server}_usercred.secret",

e.g. this is how I changed it to get it running again (though I assume you'd want to change the config to be labeled access_token instead of password or modify how init_client works.

    def login(self):
        self.log.info(f"Logging in to {self.config.bot_account.server} using API Key")
        self.client = Mastodon(api_base_url=self.config.bot_account.server, access_token=self.config.bot_account.password)
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

1 participant