omniauth-salesforce icon indicating copy to clipboard operation
omniauth-salesforce copied to clipboard

Rails: Salesforce Omniauth able to logout from my application but not logout from salesforce

Open rajcybage opened this issue 8 years ago • 2 comments

I have one Rails application where I am using salesforce omniauth

I am able to logout by making reset_session. But I am not completely logout from salesforce as when user again click login it will redirect to omniauth and login automatically.

I did below steps

gem 'omniauth-salesforce'

and model

class User < ActiveRecord::Base
    def self.from_omniauth(auth)
      where(auth.slice(:provider, :uid).permit!).first_or_initialize.tap do |user|
        user.provider = auth.provider
        user.uid = auth.uid
        user.name = auth.info.name
        user.oauth_token = auth.credentials.token
        user.refresh_token = auth.credentials.refresh_token
        user.instance_url = auth.credentials.instance_url
        user.save!
      end
    end
  end
class SessionsController < ApplicationController
    def create
      user = User.from_omniauth(env["omniauth.auth"])
      session[:user_id] = user.id
      redirect_to root_url
    end

    def destroy
      session[:user_id] = nil
      redirect_to root_url
    end
  end
 end

I am new on salesforce omniauth. Please suggest how can I able to logout from my app as well as salesforce both.

rajcybage avatar Oct 06 '16 10:10 rajcybage

Answered this at https://github.com/realdoug/omniauth-salesforce/issues/21

realdoug avatar Oct 06 '16 21:10 realdoug

how to invalidate or revoke token using this gem? any sample code..

rnagulapalle avatar Jun 27 '18 16:06 rnagulapalle