I am trying to follow the steps to upload files to Amazon S3 from an iOS app.
According to the AWS iOS SDK docs, before uploading, it is required to authenticate the app users for secure access to AWS resources via my backend server: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#providing-creds
What is the right way to call the AWS Cognito Identity GetOpenIdTokenForDeveloperIdentity service from a rails (version 4.1) server?
This service is not part of the aws-sdk gem.
Cognito is only supported via the the v2 Ruby SDK.
Here is a minimal example for GetOpenIdTokenForDeveloperIdentity
using the v2 SDK:
require 'aws-sdk'
cognito = Aws::CognitoIdentity::Client.new(region:'us-east-1')
resp = cognito.get_open_id_token_for_developer_identity(
identity_pool_id: 'IDENTITY_POOL_ID',
logins: {'MY_PROVIDER_NAME' => 'USER_IDENTIFIER'})
- IDENTITY_POOL_ID - The ID of your pool
- MY_PROVIDER_NAME - The provider name you configured on your identity pool
- USER_IDENTIFIER - The unique identifier for this user in your system
The response (when successful) will contain an identity_id
and token
for your user, which can be passed back to your mobile application.
来源:https://stackoverflow.com/questions/26704404/upload-to-amazon-s3-and-calling-amazon-cognito-identity-from-rails-server