In my rails 3 application, I am using carrierwave gem (version 0.5.6). I would like to use Google Storage for developers for storing the uploaded files. I have created an initalizer which looks like following:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'Google',
:google_storage_access_key_id => 'xxxx',
:google_storage_secret_access_key => 'yyyy'
}
config.fog_directory = 'directory'
end
I am getting 403 forbidden message with
...<Error><Code>InvalidSecurity</Code><Message>The provided security credentials are not valid.</Message>...
I have just enabled my Google Storage using the apis-console, and I can upload files using the online 'Google Storage Manager'. For 'google_storage_access_key_id' in the initializers file above, I am using 'Google Storage Id' for 'You' in the 'Storage Access' page. For 'google_storage_secret_access_key', I am us开发者_Python百科ing the 'Legacy storage access keys'.
I don't know how to proceed. Could someone kindly point me towards how to get about debugging this issue?
Thanks, Saksham
It took me almost a complete day to find the correct keys in the Google API Console. I could not find the information at all in the new interface.
Here are the minimal steps to find your access key and secret:
- open the old API console
- enable interoperable access by pressing the button (it says: make it the default for interoperable access, but without pressing this button, I did not get the "interoperable access" tab)
- pressing the button will show two sub-menus under
Google Cloud Storage
: Storage Access and Interoperable Access; click on Interoperable Access - there you will see the access key (hint: it starts with
GOOG
)- fill in in
google_storage_access_key_id
)
- fill in in
- press the
Show
button behind the access key to actually show the corresponding secret- fill in in
google_storage_secret_access_key
- fill in in
I hopes this helps! I found the names of the fog-configuration-keys confusing enough to actually switch the values, and it took me ages to actually discover the Show
button actually showed the secret.
It sounds like you've enabled the legacy access keys for your account. From the Google APIs console select Google Storage and then click on legacy access.
Use the access key from that page here:
google_storage_access_key_id => 'xxxx',
From the APIs console click show to display your secret key. Use that key here:
google_storage_secret_access_key => 'yyyy'
Do not use the Google ID for legacy access.
Hope this helps,
Anthony
To generate a developer key in 2016:
Visit this page: https://console.cloud.google.com/projectselector/storage/settings
- Create or Select a project.
- Select Interoperability.
- If you have not set up interoperability before, click Enable interoperability access.
- Click Create a new key.
The Google API console gui is not the most friendly user interface, so that's why I'm putting detailed instructions. I am writing this as of October 2013. The interface is now changed but Google API Console still enables you to use legacy access. If you are using the new Google Cloud Console, look on the bottom left hand corner and you will see the message "This is an experimental version of the API Access page. Some features may not be available." Click the words "API Access page" to get you to the legacy access. Then on the left menu select "Google Cloud Storage". Underneath that you will see two other fixed submenus, "Storage Access" and "Interoperable Access". On the "Storage Access" submenu page, enable "Interoperable Access" if you haven't done so already. Then on the "Interoperable Access" submenu page, you can get your Storage Access Keys for use in fog configuration.
精彩评论