ueberauth / ueberauth_vk

vk.com OAuth2 Strategy for Überauth.
https://hex.pm/packages/ueberauth_vk
MIT License
19 stars 12 forks source link

Current vk.com API version is deprecated, all requests are failing #108

Open ARtoriouSs opened 4 years ago

ARtoriouSs commented 4 years ago

vk.com API returns an error during callback because current API version in request (v5.8) is deprecated since 1st June 2020

Reproduction

Try authenticating with /auth/vk, after redirect to callback it fails with the fallowing error:

(FunctionClauseError) no function clause matching in List.first/1

This happens because of current version deprecation, see the users.get API response:

%{      
  "error" => %{
    "error_code" => 8,
    "error_msg" => "Invalid request: versions below 5.21 are deprecated. Version param should be passed as \"v\". \"version\" param is invalid and not supported. For more information go to https://vk.com/dev/constant_version_updates",
    "request_params" => [
      %{
        "key" => "fields",
        "value" => "first_name,last_name,bdate,education,universities,domain,photo_400,photo_100"
      },
      %{"key" => "user_ids", "value" => "138555414"},
      %{"key" => "v", "value" => "5.8"},
      %{"key" => "method", "value" => "users.get"},
      %{"key" => "oauth", "value" => "1"}
    ]
  }
}

Fix

Updating to a newer version solves the problem, according to this doc the latest version is 5.124. According to changelog there are no critical changes to users.get, so I think the version can be safely updated. See #109

ARtoriouSs commented 4 years ago

@sobolevn, thanks for accepting a PR! I think this issue can be closed now, but would you mind updating a Hex release? With the latest 0.3.1 version it will still fail on every request

sobolevn commented 4 years ago

I guess this should 0.4