Upload to Amazon S3 and Calling Amazon Cognito Identity from Rails server

前端 未结 1 1163
温柔的废话
温柔的废话 2021-01-20 02:32

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 th

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 02:45

    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.

    0 讨论(0)
提交回复
热议问题