Skip to content
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

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

Open
rajcybage opened this issue Oct 6, 2016 · 2 comments

Comments

@rajcybage
Copy link

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.

@realdoug
Copy link

realdoug commented Oct 6, 2016

Answered this at realdoug/omniauth-salesforce#21

@rnagulapalle
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants