Comments (3)
I have updated the user method in auth_controller to send correct information :
def user
hash = {
:provider => 'josh_id',
:id => current_user.id.to_s,
:info => {
:email => current_user.email
},
:extra => {
:first_name => current_user.first_name,
:last_name => current_user.last_name
}
}
render :json => hash.to_json
end
from sso-devise-omniauth-provider.
Then I change the create methode inside UserSessionsController :
def create
omniauth = env['omniauth.auth']
logger.debug "+++ #{omniauth}"
logger.debug "+++ #{omniauth.extra.raw_info.extra}"
user = User.find_by_uid(omniauth['uid'])
if not user
# New user registration
user = User.create!(:uid => omniauth['uid'],
:first_name => omniauth.extra.raw_info.extra.first_name,
:last_name => omniauth.extra.raw_info.extra.last_name)
end
# Currently storing all the info
session[:user_id] = omniauth
flash[:notice] = "Successfully logged in"
redirect_to root_path
end
from sso-devise-omniauth-provider.
Your lookup is wrong.
In AuthController, you have 'extra.first_name' but in the UserSessionsController you have 'extra.raw_info.extra.first_name'
Change AuthController#user to
...
:extra => {
:raw_info => {
:first_name => current_user.first_name,
:last_name => current_user.last_name
}
}
and in UserSessionsController#create
user = User.create!(:uid => omniauth['uid'],
:first_name => omniauth.extra.raw_info.first_name,
:last_name => omniauth.extra.raw_info.last_name)
end
Did the logger info print differently? Reopen if this is an issue.
from sso-devise-omniauth-provider.
Related Issues (14)
- Account linking strategy HOT 1
- Error code 191 on facebook authentication HOT 3
- invalid_credentials in production environment HOT 11
- Cannot sign in by default HOT 7
- invalid credentials when using omniauth v1.1.1
- :omniauthable HOT 2
- License? HOT 2
- uninitialized constant Devise::Models::TokenAuthenticatable
- OAuth2::Error HOT 1
- redirect loop ; too many redirects HOT 3
- fully sign out HOT 2
- Upgraded Rails, new omniauth - not working HOT 20
- AccessToken expiry... HOT 3
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 sso-devise-omniauth-provider.