How do I reconnect into the PKCE flow after an omniauth callback?

82 views Asked by At

I'm working on an auth server, using devise, omniauth, and doorkeeper.

I can initiate the PKCE flow, follow the omniauth (and become authenticated).

In the omniauth callback , I see that I'm an authenticated, and If I immediately redirect in the omniauth I seem to break out of the pkce flow and I'm unable to get the token from doorkeeper.

How do I pick up the pkce flow after I get the callback from omniauth?
doorkeeper code that starts this part of the flow in doorkeeper initializer

resource_owner_authenticator do
  session[:application_redirect] = request.params[:redirect_uri]

  current_user || warden.authenticate!(scope: :user)
end

my callback

def omniauth_success_callback
  @user = User.from_omniauth(request.env["omniauth.auth"])

  session[:state] = request.env["omniauth.auth"]["uid"]

  # I need to pick up the pkce flow in doorkeeper from here if I have an application redirect
  redirect_to (session[:appliaction_redirect) || other_path), allow_other_host: true
end
0

There are 0 answers