Auth-service.ts In the sign-in and sign-up methods, I am attempting to store authenticated user data. However, I encountered an error indicating that the object is of an unknown type.
signUp(email:any, password:any){
return this._http.post<AuthResponse>('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key='+ config.API_KEY, {
email: email,
password: password,
returnSecureToken: true
}).pipe(
catchError(err =>{
return err;
}),tap(res => {
this.authenticatedUser(res.email, res.localId, res.idToken , +res.expiresIn)
})
)
}
signIn(email:any, password:any){
return this._http.post<AuthResponse>('https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key='+ config.API_KEY, {
email: email,
password: password,
returnSecureToken: true
}).pipe(
catchError(err =>{
return err;
}),tap(res =>{
this.authenticatedUser(res.email, res.localId, res.idToken , +res.expiresIn)
~~~ ~~~ ~~~ ~~~(object is type of unknown)
})
)
}
AuthResponse-interface I have created an interface for response type in which I define the properties for using Firebase API.
export interface AuthResponse {
idToken: string,
email: string,
refreshToken: string,
expiresIn: string,
localId: string,
registered? : string
}