【问题标题】:Checking Amazon Cognito Roles (Auth vs Unauth)检查 Amazon Cognito 角色(Auth 与 Unauth)
【发布时间】:2016-09-11 03:42:36
【问题描述】:

我刚开始使用 AWS 作为我的 iOS 移动应用程序的后端。我已经设置了所需的所有角色和身份池。我已将以下代码添加到我的 AppDelegate.m 文件中:

// Starting AWS
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"IdentityPool"];

AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider];

下一步要查看我是否已通过身份验证?试图弄清楚 iOS 代码,看看我是什么角色。

AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;

【问题讨论】:

    标签: ios authentication amazon-web-services aws-lambda amazon-cognito


    【解决方案1】:

    在您想要使用 AWS 的地方导入服务标头,然后尝试调用 AWS 服务。

    AWSS3Transfermanager *transferManager = [AWSS3Transfermanager defaultS3TransferManager];
    AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
    uploadRequest.bucket = yourBucket;
    uploadRequest.key = yourKey;
    uploadRequest.body = yourDataURL;
    uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:fileSize];
    
    [[transferManager upload:uploadRequest] continueWithBlock:^id(AWSTask *task) {
        // Do something with the response
        return nil;
    }];
    

    【讨论】:

      猜你喜欢
      • 2018-07-05
      • 2018-10-08
      • 2021-08-18
      • 2020-01-06
      • 2020-10-16
      • 1970-01-01
      • 2015-08-08
      • 1970-01-01
      • 2018-12-15
      相关资源
      最近更新 更多