Comments (11)
Please see https://developer.linkedin.com/forum/how-can-i-get-big-profile-picture
from omniauth-linkedin-oauth2.
@abrambailey It seems this link is dead. I'm seeing a lot of places suggest adding "picture-urls::(original)" to the field in devise.rb
config.omniauth :linkedin, app_key, app_secret,
scope: 'r_basicprofile r_emailaddress',
fields: %w(id email-address first-name last-name picture-urls::(original))
but this does not seem to work. I get all of the other fields but no additional picture urls are returned. At first I thought linkedin changed their api but it still references this field in their documentation.
from omniauth-linkedin-oauth2.
I did this ... abrambailey@58b732e
Then in omniauth callbacks controller
def linkedin
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_linkedin_oauth2(request.env["omniauth.auth"])
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "LinkedIn"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.linkedin_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
Then in user.rb
def self.find_for_linkedin_oauth2(access_token, signed_in_resource=nil)
data = access_token.info
user = User.where(:email => data["email"]).first
unless user
if (data[:image][:values] rescue nil) != nil
url = data[:image][:values][0]
user = User.create(
username: data["name"],
email: data["email"],
password: Devise.friendly_token[0,20],
role_ids: [Role.find_by(name: "dispenser").id],
avatar: open(url)
)
else
user = User.create(
username: data["name"],
email: data["email"],
password: Devise.friendly_token[0,20],
role_ids: [Role.find_by(name: "dispenser").id]
)
end
end
user
end
from omniauth-linkedin-oauth2.
Hmmm and this still works for you as of today? - I'm doing something very similar. I've added the "'picture-urls::(original)'" to fields as well (did this in devise.rb instead) but "url = data[:image][:values][0]" never returns anything.
from omniauth-linkedin-oauth2.
https://www.hearingtracker.com/users/sign_in
Try it and let me know. Just fill in your name and sex, and I'll remove your account.
from omniauth-linkedin-oauth2.
Doesn't seem like it worked :(
from omniauth-linkedin-oauth2.
Well crap. Thanks for noticing this bug. I guess no one reported it to me, and we weren't testing it.
from omniauth-linkedin-oauth2.
Not even sure when it stopped working.
from omniauth-linkedin-oauth2.
from omniauth-linkedin-oauth2.
I'm actually amazed that I caught it this quickly. Thanks @ishields !
from omniauth-linkedin-oauth2.
Deleted your user account, email, etc, from our server. Fwiw.
from omniauth-linkedin-oauth2.
Related Issues (20)
- Incompatibility of gems HOT 1
- Add support for LinkedIn v2 API. HOT 3
- Get the original referer HOT 1
- Unauthorised scope r_liteprofile with linkedin oauth2 HOT 9
- release version that supports omniauth-oauth2 v1.5 HOT 1
- Failing to get /me HOT 5
- Authenticating always shows "allow/deny" prompt for legacy linkedin app HOT 3
- Secret is nil HOT 1
- Getting timeout from Faraday when requesting access_token, email_addrees or profile info HOT 3
- Authentication failure! invalid_credentials: OAuth2::Error HOT 3
- Does the gem return the refresh token when a token is expired? HOT 1
- Non-default scopes
- You need to pass the "client_id" parameter HOT 5
- Using r_emailaddress as scope giving Authentication failure! invalid_credentials: OAuth2::Error HOT 1
- OmniAuth::AuthenticityError HOT 1
- Authentication failure! Connection reset by peer: Faraday::SSLError
- The authorization flow opens the linkedin app and never returns to the callback url (IPHONE) HOT 1
- Why is commit with refresh token support not released to rubygem
- No longer works with oauth2 gem v2.0+ HOT 7
- A required parameter "client_secret" is missing HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omniauth-linkedin-oauth2.