Lynnesbian / Lynnesbian/OCRbot

login.py fails with Plerom after secret is entered

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
71
Forks
9
PR merge metrics
No merged PRs in 30d

Description

After copying the secret over from Pleroma to command line where I started login.py I get this error:
Traceback (most recent call last):

  File "/home/utzer/.local/lib/python3.10/site-packages/mastodon/Mastodon.py", line 525, in log_in
    response = self.__api_request('POST', '/oauth/token', params, do_ratelimiting=False)
  File "/home/utzer/.local/lib/python3.10/site-packages/mastodon/Mastodon.py", line 3425, in __api_request
    raise ex_type(
mastodon.Mastodon.MastodonAPIError: ('Mastodon API returned error', 400, 'Bad Request', 'Invalid credentials')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/utzer/ocrbot/login.py", line 66, in <module>
    cfg['secret'] = client.log_in(code=input("Secret: "), scopes=scopes)
  File "/home/utzer/.local/lib/python3.10/site-packages/mastodon/Mastodon.py", line 533, in log_in
    raise MastodonIllegalArgumentError('Invalid access token or redirect_uris: %s' % e)
mastodon.Mastodon.MastodonIllegalArgumentError: Invalid access token or redirect_uris: ('Mastodon API returned error', 400, 'Bad Request', 'Invalid credentials')

Wondering if there is any tip why the connection fails.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at login.py line 66 and compare the arguments passed to the Mastodon client’s log_in call with the Mastodon.py traceback. Reproduce the login flow using the copied secret, then determine why the API reports invalid credentials or redirect_uris. Done means the cause and required configuration are documented, or login succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.