* Trigger the signin with user/password. * * @returns A promise containing the authenticated `User`. * @throws ErrorResponse In cases of wrong authentication.
({
username,
password,
skipUserInfo = false,
}: SigninResourceOwnerCredentialsArgs)
| 222 | * @throws {@link ErrorResponse} In cases of wrong authentication. |
| 223 | */ |
| 224 | public async signinResourceOwnerCredentials({ |
| 225 | username, |
| 226 | password, |
| 227 | skipUserInfo = false, |
| 228 | }: SigninResourceOwnerCredentialsArgs): Promise<User> { |
| 229 | const logger = this._logger.create("signinResourceOwnerCredential"); |
| 230 | |
| 231 | const signinResponse = await this._client.processResourceOwnerPasswordCredentials({ |
| 232 | username, |
| 233 | password, |
| 234 | skipUserInfo, |
| 235 | extraTokenParams: this.settings.extraTokenParams, |
| 236 | }); |
| 237 | logger.debug("got signin response"); |
| 238 | |
| 239 | const user = await this._buildUser(signinResponse); |
| 240 | if (user.profile && user.profile.sub) { |
| 241 | logger.info("success, signed in subject", user.profile.sub); |
| 242 | } else { |
| 243 | logger.info("no subject"); |
| 244 | } |
| 245 | return user; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Trigger a request (via a popup window) to the authorization endpoint. |
no test coverage detected