Jesus / dropbox_api

Ruby client library for Dropbox API v2
MIT License
171 stars 113 forks source link

Token is malformed, Expecting "Bearer <oauth2-access-token>" #90

Closed Nicehax101 closed 2 years ago

Nicehax101 commented 3 years ago

i try to make the client exactly as explained inside the docs like this:

access_token = OAuth2::AccessToken.from_hash(authenticator, token_hash)

the Dropbox::Token::Save is just a module that saves the token

    client = DropboxApi::Client.new(
      access_token: access_token,
      on_token_refreshed: lambda { |new_token_hash|
        Dropbox::Token::Save.perform(new_token_hash)
      }
    )

the problem is the client gives me this error:

DropboxApi::Errors::HttpError Exception: HTTP 400: Error in call to API function "files/list_folder": Invalid authorization value in HTTP header "Authorization": "Bearer access_token=\"#<OAuth2::AccessToken:0x00007f72ce27efc8>\", on_token_refreshed=\"#<Proc:0x00007f72cdf7d6d0@(byebug):3 (lambda)>\"". Expecting "Bearer <oauth2-access-token>". and it doesnt refresh the token and doesnt save it.

and even if i dont send the on_token_refresh the error will be : DropboxApi::Errors::HttpError Exception: HTTP 400: Error in call to API function "files/list_folder": The given OAuth 2 access token is malformed.

looks like the DropboxApi::Client module is not accepting those correctly. it'd be amazing if someone could help me thanks

Nicehax101 commented 2 years ago

anyone ?

Nicehax101 commented 2 years ago

the problem was that Faraday gem which is a dependency of the dropbox_api was not getting updated correctly by bundle install so i did bundle update dropbox_api and it fixed it