Ich versuche, mich über Facebook zu registrieren, um einen Benutzer mit Avatar mit Büroklammer erstellen und Amazon S3 zu meiner Website verwenden, um Benutzeravatare zu speichern. Ich erwarte, dass Benutzer ihren Profilen einen Avatar hinzufügen können, aber es scheint, dass mir der Zugriff verweigert wird. Ich habe mehrere Lösungen ohne Erfolg angeschaut und ausprobiert.Speichern Benutzer Avatar auf Büroklammer und Aws :: S3 :: Fehler :: AccessDenied
Hier sind die Fehler in meinem Browser:
Aws::S3::Errors::AccessDenied in SessionsController#create
Access Denied
Extrahiert Quelle (um Zeile # 19):
17
18
19 def self.create_user_from_facebook(auth)
create(
avatar: process_uri(auth['info']['image'] + "?width=9999"),
email: auth['info']['email'],
provider: auth['provider'],
in the commnad-line errors:
SQL (0.6ms) INSERT INTO "users" ("provider", "uid", "name", "email", "created_at", "updated_at", "avatar_file_name", "avatar_content_type", "avatar_file_size", "avatar_updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["provider", "facebook"], ["uid", "10209320526747935"], ["name", "Ziv Steeven Zamechek"], ["email", "[email protected]"], ["created_at", 2016-11-12 18:15:38 UTC], ["updated_at", 2016-11-12 18:15:38 UTC], ["avatar_file_name", "picture"], ["avatar_content_type", "image/jpeg"], ["avatar_file_size", 15297], ["avatar_updated_at", 2016-11-12 18:15:38 UTC]]
[paperclip] saving /users/avatars/000/000/001/original/picture
(0.3ms) rollback transaction
Completed 500 Internal Server Error in 409ms (ActiveRecord: 1.8ms)
Aws::S3::Errors::AccessDenied (Access Denied):
app/models/user.rb:19:in `create_user_from_facebook'
app/models/user.rb:15:in `sign_in_from_facebook'
app/controllers/sessions_controller.rb:6:in `create'
hier ist die user.rb:
class User < ActiveRecord::Base
has_many :friendships, dependent: :destroy
has_many :inverse_friendships, class_name: "Friendship", foreign_key: "friend_id", dependent: :destroy
has_attached_file :avatar,
:storage => :s3,
:style => { :medium => "370x370", :thumb => "100x100" }
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
default_scope { order('id DESC') }
def self.sign_in_from_facebook(auth)
find_by(provider: auth['provider'], uid: auth['uid']) || create_user_from_facebook(auth)
end
def self.create_user_from_facebook(auth)
create(
avatar: process_uri(auth['info']['image'] + "?width=9999"),
email: auth['info']['email'],
provider: auth['provider'],
uid: auth['uid'],
name: auth['info']['name'],
gender: auth['extra']['raw_info']['gender'],
date_of_birth: auth['extra']['raw_info']['birthday'],
location: auth['info']['location'],
bio: auth['extra']['raw_info']['bio']
)
end
end
Meine github Repo: https://github.com/zivolution921/tinstuk