Closed JustMikey closed 8 years ago
What's your setup? This is working for me.
The pattern match is done by the last pipe operator result:
{_, photo_url} =
user
|> Enum.filter(fn {k, _v} -> String.starts_with?(k, "photo_") end)
|> Enum.sort_by(fn {"photo_" <> size, _v} -> Integer.parse(size) end)
|> List.last
Since VK
has different attributes for images like: photo_50
, photo_100
and so on, what we do here is:
photo_
tuple
: {photo_size, photo_url}
Proof:
That's my foolish mistake, I had a quick look and didn't get it correctly. Anyway, as far as I know, those fields, photo_50
, photo_100
and so on should be requested in the users.get
request (the fields
param) but it doesnt look like they are by default.
You have to configure the non-default fields in your app's settings:
config :ueberauth, Ueberauth,
providers: [
vk: { Ueberauth.Strategy.VK, [profile_fields: "photo_100,sex,bdate"] }
]
I found a bug you were talking about. If missing any photo_*
params the code will fail. Fixed that already. I will push it with other improvements shortly.
Thanks!
Yeah I know, It just should be default if it's always assumed that those fields are present :) And thank you for fixing it so fast :)
Any feedback is welcomed. If everything is cool, I will create a new release.
The pattern matching breaks here because
user
seems to be just a map, not a tuple.