小编Ell*_*iot的帖子

iOS(Swift)应用程序中的AWS Cognito用户池

我正在尝试在我的iOS(Swift)应用程序中实现新的AWS Cognito用户池,但我很难让登录过程工作.我基本上试图遵循这里提供的示例.

这是我到目前为止:

AppDelegate中:

class AppDelegate: UIResponder, UIApplicationDelegate, AWSCognitoIdentityInteractiveAuthenticationDelegate {
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        let serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.USEast1, credentialsProvider: nil)
        AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = serviceConfiguration
        let configurationUserPool = AWSCognitoIdentityUserPoolConfiguration(
            clientId: "###",
            clientSecret: "#########",
            poolId: "###")
        AWSCognitoIdentityUserPool.registerCognitoIdentityUserPoolWithConfiguration(serviceConfiguration, userPoolConfiguration: configurationUserPool, forKey: "UserPool")
        self.userPool = AWSCognitoIdentityUserPool(forKey: "UserPool")

        self.userPool!.delegate = self

        return true
    }

    func startPasswordAuthentication() -> AWSCognitoIdentityPasswordAuthentication {
        let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let logInNavigationController = mainStoryboard.instantiateViewControllerWithIdentifier("LogInNavigationController") as! UINavigationController

        dispatch_async(dispatch_get_main_queue(), {
            self.window?.rootViewController = …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services ios amazon-cognito

13
推荐指数
2
解决办法
1万
查看次数

如何使用 npm 链接修复 Angular 库中的“未找到模块”错误?

我正在尝试为 Javascript 库构建一个 Angular 包装器,但出现“找不到模块”错误。Javascript 库正在开发中,尚未发布到 NPM,所以我使用的是 npm-link,这可能会导致问题,但我不确定。我的 Angular 版本是 8.2.2。

Javascript 源代码库

源库/index.js:

var sourcelib = (function () {
    var doSomething = function() {
    };
    return {
        doSomething: doSomething
    };
})();
export default sourcelib;
Run Code Online (Sandbox Code Playgroud)

sourcelib目录还包含的package.jsonREADME.md文件。如您所料,创建了一个 npm-link:

cd sourcelib
npm link
Run Code Online (Sandbox Code Playgroud)

角度包装器

以下是我正在执行以创建 Angular 工作区、库和测试应用程序的 Angular CLI 命令:

ng new app-test --create-application=false
cd app-test
ng generate library testlib
ng generate application testlib-app
Run Code Online (Sandbox Code Playgroud)

现在将testlib链接到 Javascript 库:

cd projects/testlib
npm link sourcelib
Run Code Online (Sandbox Code Playgroud)

testlib …

javascript npm typescript npm-link angular

7
推荐指数
1
解决办法
5769
查看次数

如何在Lambda函数中使用AWS.CloudFront.Signer

我正在尝试使用Lambda生成并返回已签名的cookie,以便我的iOS应用程序可以使用cookie通过CloudFront访问受限文件.

我认为这应该可以使用Signer类:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFront/Signer.html

在此基础上,我编写了以下Lambda函数:

var AWS = require('aws-sdk');
var keyPairId = 'APK...';
var privateKey = 'MIIE...';
var signer = new AWS.CloudFront.Signer(keyPairId, privateKey);

exports.handler = function(event, context) {
    var options = {url: "https://xxxxxx.cloudfront.net", expires: 1357100000};

    signer.getSignedCookie(options, function(err, data) {
        if (err) {
            context.fail(err);
        } else {
            context.succeed('Success');
        }
    });
};
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用.我一直收到错误'在完成请求之前退出流程'.我已经尝试了'options'参数格式的许多排列,但没有任何区别.

任何帮助,将不胜感激.

lambda amazon-web-services node.js amazon-cloudfront

6
推荐指数
1
解决办法
1451
查看次数