我很难让电子,angular2和aws-放大(8月)工作.所有东西都在浏览器中工作,但是当我尝试用电子方式运行我的应用程序时,我得到:
错误ReferenceError:未定义Auth
我使用的是角-cli,并安装有npm的aws放大。
有人知道我是怎么解决这个问题的吗?
发布于 2018-03-19 17:23:12
获取Auth对象然后登录有两种方法。
import Amplify from 'aws-amplify';
Amplify.Auth.signIn(...)或
import { Auth } from 'aws-amplify';
Auth.signIn(...)发布于 2018-03-08 18:17:54
我用Amplify.Auth.signIn代替Auth.signIn在浏览器和电子中工作,解决了这个问题。
发布于 2018-08-26 10:48:01
如果发生了将Auth放到异步函数中的情况,那么您需要这样做:
更改函数签名并添加auth输入,然后为该参数提供Auth,然后在函数中使用auth:
import { Auth } from "aws-amplify";
await this.handleLoginCallback(
this.auth2.currentUser.get().getBasicProfile(),
this.auth2.currentUser.get().getAuthResponse(),
Auth
);
public async handleLoginCallback(basicProfile, authResponse, auth): Promise<any> {
const results = await auth.federatedSignIn("google", { token: id_token, expires_at }, guser);
}
https://stackoverflow.com/questions/49178456
复制相似问题