forked from jnabor/ra2-serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added alternative facebook login method
- Loading branch information
Showing
10 changed files
with
374 additions
and
202 deletions.
There are no files selected for viewing
113 changes: 67 additions & 46 deletions
113
amplify/backend/auth/ra2serverless240b4340/parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,68 @@ | ||
{ | ||
"identityPoolName": "ra2serverless240b4340_identitypool_34543397", | ||
"allowUnauthenticatedIdentities": false, | ||
"resourceNameTruncated": "ra2ser240b4340", | ||
"userPoolName": "ra2serverless240b4340_userpool_240b4340", | ||
"autoVerifiedAttributes": ["email"], | ||
"mfaConfiguration": "OFF", | ||
"mfaTypes": ["SMS Text Message"], | ||
"smsAuthenticationMessage": "Your authentication code is {####}", | ||
"smsVerificationMessage": "Your verification code is {####}", | ||
"emailVerificationSubject": "Your verification code", | ||
"emailVerificationMessage": "Your verification code is {####}", | ||
"defaultPasswordPolicy": false, | ||
"passwordPolicyMinLength": 8, | ||
"passwordPolicyCharacters": [], | ||
"requiredAttributes": ["email"], | ||
"userpoolClientGenerateSecret": true, | ||
"userpoolClientRefreshTokenValidity": 30, | ||
"userpoolClientWriteAttributes": ["email"], | ||
"userpoolClientReadAttributes": ["email"], | ||
"userpoolClientLambdaRole": "ra2ser240b4340_userpoolclient_lambda_role", | ||
"userpoolClientSetAttributes": false, | ||
"resourceName": "ra2serverless240b4340", | ||
"authSelections": "identityPoolAndUserPool", | ||
"authRoleArn": { | ||
"Fn::GetAtt": ["AuthRole", "Arn"] | ||
}, | ||
"unauthRoleArn": { | ||
"Fn::GetAtt": ["UnauthRole", "Arn"] | ||
}, | ||
"useDefault": "defaultSocial", | ||
"hostedUI": true, | ||
"usernameAttributes": ["email"], | ||
"triggers": "{}", | ||
"hostedUIDomainName": "ra2-serverless", | ||
"authProvidersUserPool": ["Facebook", "Google"], | ||
"hostedUIProviderMeta": "[{\"ProviderName\":\"Facebook\",\"authorize_scopes\":\"email,public_profile\",\"AttributeMapping\":{\"email\":\"email\",\"username\":\"id\"}},{\"ProviderName\":\"Google\",\"authorize_scopes\":\"openid email profile\",\"AttributeMapping\":{\"email\":\"email\",\"username\":\"sub\"}}]", | ||
"userPoolGroupList": [], | ||
"parentStack": { | ||
"Ref": "AWS::StackId" | ||
}, | ||
"permissions": [], | ||
"dependsOn": [], | ||
"userPoolGroups": false, | ||
"adminQueries": false, | ||
"oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\",\"implicit\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"https://ra2-dev.sonabstudios.com/\"],\"LogoutURLs\":[\"https://ra2-dev.sonabstudios.com/\"]}" | ||
} | ||
"identityPoolName": "ra2serverless240b4340_identitypool_34543397", | ||
"allowUnauthenticatedIdentities": false, | ||
"resourceNameTruncated": "ra2ser240b4340", | ||
"userPoolName": "ra2serverless240b4340_userpool_240b4340", | ||
"autoVerifiedAttributes": [ | ||
"email" | ||
], | ||
"mfaConfiguration": "OFF", | ||
"mfaTypes": [ | ||
"SMS Text Message" | ||
], | ||
"smsAuthenticationMessage": "Your authentication code is {####}", | ||
"smsVerificationMessage": "Your verification code is {####}", | ||
"emailVerificationSubject": "Your verification code", | ||
"emailVerificationMessage": "Your verification code is {####}", | ||
"defaultPasswordPolicy": false, | ||
"passwordPolicyMinLength": 8, | ||
"passwordPolicyCharacters": [], | ||
"requiredAttributes": [ | ||
"email" | ||
], | ||
"userpoolClientGenerateSecret": true, | ||
"userpoolClientRefreshTokenValidity": 30, | ||
"userpoolClientWriteAttributes": [ | ||
"email" | ||
], | ||
"userpoolClientReadAttributes": [ | ||
"email" | ||
], | ||
"userpoolClientLambdaRole": "ra2ser240b4340_userpoolclient_lambda_role", | ||
"userpoolClientSetAttributes": false, | ||
"resourceName": "ra2serverless240b4340", | ||
"authSelections": "identityPoolAndUserPool", | ||
"authRoleArn": { | ||
"Fn::GetAtt": [ | ||
"AuthRole", | ||
"Arn" | ||
] | ||
}, | ||
"unauthRoleArn": { | ||
"Fn::GetAtt": [ | ||
"UnauthRole", | ||
"Arn" | ||
] | ||
}, | ||
"useDefault": "defaultSocial", | ||
"hostedUI": true, | ||
"usernameAttributes": [ | ||
"email" | ||
], | ||
"triggers": "{}", | ||
"hostedUIDomainName": "ra2-serverless", | ||
"authProvidersUserPool": [ | ||
"Facebook", | ||
"Google" | ||
], | ||
"hostedUIProviderMeta": "[{\"ProviderName\":\"Facebook\",\"authorize_scopes\":\"email,public_profile\",\"AttributeMapping\":{\"email\":\"email\",\"username\":\"id\"}},{\"ProviderName\":\"Google\",\"authorize_scopes\":\"openid email profile\",\"AttributeMapping\":{\"email\":\"email\",\"username\":\"sub\"}}]", | ||
"userPoolGroupList": [], | ||
"parentStack": { | ||
"Ref": "AWS::StackId" | ||
}, | ||
"permissions": [], | ||
"dependsOn": [], | ||
"userPoolGroups": false, | ||
"adminQueries": false, | ||
"oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\",\"implicit\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"https://ra2-dev.sonabstudios.com/\"],\"LogoutURLs\":[\"https://ra2-dev.sonabstudios.com/\"]}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react' | ||
import { useHistory } from 'react-router-dom' | ||
|
||
import EmailIcon from '@material-ui/icons/Email' | ||
import Button from '@material-ui/core/Button' | ||
import { useStyles } from './components/styles' | ||
|
||
export interface HostedUiSignInProps {} | ||
|
||
const HostedUiSignIn: React.SFC<HostedUiSignInProps> = () => { | ||
const history = useHistory() | ||
const classes = useStyles() | ||
|
||
return ( | ||
<Button | ||
fullWidth | ||
variant='contained' | ||
onClick={() => history.push('/auth')} | ||
size='large' | ||
className={classes.google}> | ||
<div className={classes.container}> | ||
<div className={classes.spacer} /> | ||
<div className={classes.fsignLabel}> | ||
<div className={classes.logo}> | ||
<EmailIcon /> | ||
</div> | ||
Sign in with Email | ||
</div> | ||
</div> | ||
</Button> | ||
) | ||
} | ||
|
||
export default HostedUiSignIn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useContext } from 'react' | ||
|
||
import { AuthContext } from './auth-context' | ||
import Button from '@material-ui/core/Button' | ||
import { useStyles } from './components/styles' | ||
import facebookLogo from '../static/facebook.png' | ||
|
||
export interface FacebookSignInProps {} | ||
|
||
const FacebookSignIn: React.SFC<FacebookSignInProps> = () => { | ||
const authContext = useContext(AuthContext) | ||
|
||
const signInHandler = () => { | ||
authContext.federatedSignIn('facebook') | ||
} | ||
|
||
const classes = useStyles() | ||
|
||
return ( | ||
<Button | ||
fullWidth | ||
variant='contained' | ||
onClick={() => { | ||
signInHandler() | ||
}} | ||
size='large' | ||
className={classes.google}> | ||
<div className={classes.container}> | ||
<div className={classes.spacer} /> | ||
<div className={classes.fsignLabel}> | ||
<div className={classes.logo}> | ||
<img style={{ height: '22px' }} src={facebookLogo} /> | ||
</div> | ||
Sign in with Facebook | ||
</div> | ||
</div> | ||
</Button> | ||
) | ||
} | ||
|
||
export default FacebookSignIn |
Oops, something went wrong.