-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign up automatically after registration #955
Comments
@OndrejPontes I'd assume it's the same as normal login, in that you re-direct to same oauth endpoint: # in config/doorkeeper
resource_owner_authenticator do
user = # the_code_that_finds_user, varies from app to app, warden.user works if you do devise
if user
user
else
redirect_to(login_or_register_path(after_login_path: request.full_path)
end
end
# in login controller
def login
user = the_code_to_login_user # varies from app to app
if user
login(user)
if params[:after_login_path] # this you need to make sure to pass from links to initial redirect path
redirect_to(params[:after_login_path]
end
else
# handle bad username and password
end
end
# in register user controller
def create
user = User.new(permitted_user_params)
if user.save
login(user)
if params[:after_login_path] # this you need to make sure to pass from links to initial redirect path
redirect_to(params[:after_login_path]
end
else
# handle invalid user
end
end Obviously above example could use some refactoring but general gist is you try to pass the original url to place you authenticate user (wether through login or though registration) and then redirect back at end. |
Hi @OndrejPontes. Does @moger777 solution solves your problem? |
I do not remember :D and right now I do not have oportunity to verificar
isso.
Dňa 2.2.2018 19:12 používateľ "Nikita Bulai" <notifications@github.com>
napísal:
… Hi @OndrejPontes <https://github.com/ondrejpontes>. Does @moger777
<https://github.com/moger777> solution solves your problem?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#955 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOmWvFmmp7dL_lFcpTxWYlsNaReeitz8ks5tQz0LgaJpZM4NHEjr>
.
|
Ok, so currently I'm closing this issue (because there is no bug), but remind myself to add a new Wiki page :) UPD: ready |
:D
Dňa 2.2.2018 20:56 používateľ "Nikita Bulai" <notifications@github.com>
napísal:
Ok, so currently I'm closing this issue (because there is no bug), but
remind myself to add a new Wiki page :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#955 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOmWvEThRnV5esIesRouELTMKo3kCNtTks5tQ2h3gaJpZM4NHEjr>
.
|
I have read a lot of tutorials and discussions about a doorkeeper and many people try to solve how to sign up automatically after registration, but nobody mentioned how to do that.
Is something like that possible to configure in doorkeeper and if so, how to do it ?
The text was updated successfully, but these errors were encountered: