akveo / akveo/nebular

Custom NbAuthStrategy getting result from async call

Ouverte
#2,388 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
8.1k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I am creating my own authentication method. I have extended NbAuthStrategy and implemented method authenticate as shown below

```
@Injectable()
export class MyAuthStrategy extends NbAuthStrategy {
...
authenticate(user: UserData): Observable {
...
this.userService.getUser(userId, function(user: IUser) {
console.log("called back" + user); ////// ?????
});
...
}
...
}
```
the method is expected to return a Observable object.

When I do a memory authentication it works great, no issues.

The problem comes when I try to authenticate on an AWS Lambda by doing an async call. As the response is async, I cannot return Observable so I find this authentication mechanism only works for memory or synchronous calls.

How can I authenticate when validation is done on an async call?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.