Adding AWS Cognito Federated Login With Google Using AWS Amplify

Image by Thomas Breher from Pixabay

Updated Version

Scenario

Prerequisites

Configure the Amplify CLI

Generate an Angular Project and Install Dependencies

ng new amplify-google-login-test
ng add @angular/material
npm install aws-amplify

Implement the Auth Service

Import the Material Button Module

import { MatButtonModule } from '@angular/material/button';imports: [
...
MatButtonModule
]
<button  mat-flat-button color="accent"   
(click)="signInWithGoogle()">
Login with Google
</button>

Add Amplify

amplify init

Complete the Google Social Provider Setup

amplify add auth

Complete Angular Scaffolding

Final Step

"oauth": {
"domain": "googlelogin-a1963b82-dev.auth.us-east-1.amazoncognito.com"
}
https://googlelogin-a1963b82-dev.auth.us-east-1.amazoncognito.com
https://googlelogin-a1963b82-dev.auth.us-east-1.amazoncognito.com/oauth2/idpresponse

Brought to You By

Founder of Firefly Semantics Corporation