【发布时间】:2020-03-01 14:50:46
【问题描述】:
我正在尝试使用 AWS Amplify 在 React 本机应用程序中实现 Google 身份验证。我已经在我的应用中安装了 Amplify,还安装了 Auth。
授权的javascript来源:
https://inventory053721f5-053721f5-develop.auth.eu-west-1.amazoncognito.com
授权重定向 uri:
https://inventory053721f5-053721f5-develop.auth.eu-west-1.amazoncognito.com/oauth2/idpresponse
aws-exports.js:
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "***",
"aws_cognito_region": "eu-west-1",
"aws_user_pools_id": "***",
"aws_user_pools_web_client_id": "***",
"oauth": {
"domain": "***",
"scope": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
"redirectSignIn": "inventory://",
"redirectSignOut": "inventory://",
"responseType": "code"
},
"federationTarget": "COGNITO_USER_POOLS"
};
export default awsmobile;
我的App.tsx 看起来像这样:
import React, {FunctionComponent} from 'react';
import Amplify, {Auth} from 'aws-amplify';
import {Button} from 'react-native';
import config from '../../aws-exports';
Amplify.configure(config);
export interface AppProps {}
const App: FunctionComponent<AppProps> = () => {
return <Button title={'Login'} onPress={() => Auth.federatedSignIn()} />;
};
export default App;
发生了什么的视频:
【问题讨论】:
标签: reactjs amazon-web-services react-native react-native-android aws-amplify