Skip to content

Commit

Permalink
feat: add auth.generate method
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jun 22, 2020
1 parent af5c7c5 commit 1bccf0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adonis-typings/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ declare module '@ioc:Adonis/Addons/Auth' {
options?: OATLoginOptions,
): Promise<OpaqueTokenContract<GetProviderRealUser<Provider>>>

/**
* Generate token for a user without any verification
*/
generate (
user: GetProviderRealUser<Provider>,
options?: OATLoginOptions,
): Promise<OpaqueTokenContract<GetProviderRealUser<Provider>>>

/**
* Login a user using their id
*/
Expand Down
7 changes: 7 additions & 0 deletions src/Guards/Oat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ export class OATGuard extends BaseGuard implements OATGuardContract<any, any> {
return this.login(providerUser.user, options)
}

/**
* Generate token for a user. It is merely an alias for `login`
*/
public async generate (user: any, options?: OATLoginOptions) {
return this.login(user, options)
}

/**
* Login a user
*/
Expand Down

0 comments on commit 1bccf0c

Please sign in to comment.