- def create_request_token
- RequestToken.create :client_application => self, :callback_url => self.token_callback_url
+ def create_request_token(params={})
+ params = { :client_application => self, :callback_url => self.token_callback_url }
+ permissions.each do |p|
+ params[p] = true
+ end
+ RequestToken.create(params)
+ end
+
+ def access_token_for_user(user)
+ unless token = access_tokens.valid.where(:user_id => user).first
+ params = { :user => user }
+
+ permissions.each do |p|
+ params[p] = true
+ end
+
+ token = access_tokens.create(params)
+ end
+
+ token