How to end a session using the ruby-ruby client
hello im using https://github.com/adelevie/parse-ruby-client/tree/v0.3.0 gem and there is no documentation on how to end the session after login. Therefore, they are interested to know how to do it.
+3
source to share
2 answers
It looks like gem doesn't support logout directly. You have to manually make the exit call as described in https://parse.com/docs/rest/guide/#sessions-deleting-sessions
0
source to share
In User, the parse-ruby-client
gem class
logout
If you want, you can write a method like below that will log out of the current current user.
def logout
Parse.client.post("https://api.parse.com/1/logout", {})
rescue Parse::ParseProtocolError
puts "Invalid session"
end
You can also extend the classes provided by stone by doing something like this in one of your ruby ββfiles
Parse::Protocol::LOGOUT_URI = "https://api.parse.com/1/logout"
module Parse
class User
def self.logout
Parse.client.post(Parse::Protocol::LOGOUT_URI, {})
rescue Parse::ParseProtocolError => e
Parse.client.logger.error e.message
end
end
end
Then you can call the method as shown below:
Parse::User.logout
0
source to share