For the purpose of understanding, I am working on implementing a proof of concept involving AWS Cognito and API Gateway. I have customized the UserPoolId and ClientId in the authorization.service.ts file based on the instructions in a video tutorial. The application is up and running successfully on localhost:4200, but I am facing difficulties registering an account on my userpool within the AWS console.
Here are the video reference and source code links:
- Video Tutorial: https://www.youtube.com/watch?v=ROwjNYlxMAs&t=741s&ab_channel=TKousek
- Source Code: https://github.com/kousekt/angularcognitotest
To refer to the relevant component in the source code, check out the register.component.ts file:
- register.component.ts
// Angular component for user registration
import { Component } from '@angular/core';
import {NgForm} from "@angular/forms";
import {AuthorizationService} from "../shared/authorization.service";
import { Router } from '@angular/router';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css']
})
export class RegisterComponent {
// Component properties
}
- authorization.service.ts
// Service for user authorization using AWS Cognito
import { Injectable } from '@angular/core';
import {AuthenticationDetails, CognitoUser, CognitoUserPool} from 'amazon-cognito-identity-js';
import { Observable } from 'rxjs/Observable';
// User pool configuration
const poolData = {
UserPoolId: 'ap-southeast-1_4E5c8sOtF',
ClientId: '307efnv599eldkq3odcld2j3dh'
};
const userPool = new CognitoUserPool(poolData);
@Injectable()
export class AuthorizationService {
// Service methods for user registration, authentication, and more
}
View the console error log related to the registration issue