boosty icon indicating copy to clipboard operation
boosty copied to clipboard

Refresh token doesn't work

Open li7vinov-denis opened this issue 1 year ago • 4 comments

Exception has occurred: ValueError
Failed to refresh auth data: {'error_description': 'Invalid grant_type parameters', 'error': 'invalid_grant'}
KeyError: 'refresh_token'

The above exception was the direct cause of the following exception:

  File "/Users/_/Documents/Projects/py/boosty/main.py", line 22, in loginAsync
    token = await auth.refresh_auth_data(session=api.http_client, api_url=API_URL)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/_/Documents/Projects/py/boosty/main.py", line 31, in main
    asyncio.run(loginAsync())
  File "/Users/_/Documents/Projects/py/boosty/main.py", line 34, in <module>
    main()
ValueError: Failed to refresh auth data: {'error_description': 'Invalid grant_type parameters', 'error': 'invalid_grant'}

login method:

async def loginAsync():
    
    auth = Auth(auth_data=auth_data)
    
    api = API(auth=auth)
    
    await auth.refresh_auth_data(session=api.http_client, api_url=API_URL)
    
    response = await api.get_post("boosty", post_id="c9fb8a19-c45e-4602-9942-087c3af28c1b")
    
    print(response.title)

Do you need some additional details to figure out issue?

I tried to send request directly in Postman - received that response:

{
    "error_description": "Invalid parameters: device_os, refresh_token, device_id, grant_type",
    "error": "invalid_param"
}

li7vinov-denis avatar Jul 24 '24 00:07 li7vinov-denis

which auth method did you use? phone or social network one?

barsikus007 avatar Jul 24 '24 07:07 barsikus007

I used cookie from browser. in browser I was authenticated via google account

li7vinov-denis avatar Jul 24 '24 17:07 li7vinov-denis

could you wait for refresh in developer tools?

  1. just login to your account in new browser and close tab and browser
  2. wait from one day to week
  3. open new tab in browser, then open dev tools > network, then open boosty.to page
  4. filter requests by api word and find refresh one
  5. remove your tokens from request and provide it here

or you can just capture same request in your own browser if you wish

barsikus007 avatar Jul 25 '24 14:07 barsikus007

for those who come after :)

Had the same issue with grant_type being "invalid". Only after seeing this issue, realized that I was signed up using google's oauth. Switched to phone authentication, and refreshing worked. I do believe that refreshing tokens, that were given using another oauth provider, will be complicated. So I would recommend to switch to authorizing using a phone number

arslanarm avatar Jul 01 '25 10:07 arslanarm