|
|
@ -11,12 +11,7 @@ import {ErrorWithContext, uuid4, fetch} from '../../../util'
|
|
|
|
export class CoreIDLoginProvider extends OAuth2LoginProvider<OAuth2LoginProviderConfig> {
|
|
|
|
export class CoreIDLoginProvider extends OAuth2LoginProvider<OAuth2LoginProviderConfig> {
|
|
|
|
protected async callback(request: Request): Promise<Authenticatable> {
|
|
|
|
protected async callback(request: Request): Promise<Authenticatable> {
|
|
|
|
// Get authentication_code from the request
|
|
|
|
// Get authentication_code from the request
|
|
|
|
const code = String(request.input('code') || '')
|
|
|
|
const code = request.safe('code').string()
|
|
|
|
if ( !code ) {
|
|
|
|
|
|
|
|
throw new ErrorWithContext('Unable to authenticate user: missing login code', {
|
|
|
|
|
|
|
|
input: request.input(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get OAuth2 token from CoreID
|
|
|
|
// Get OAuth2 token from CoreID
|
|
|
|
const token = await this.getToken(code)
|
|
|
|
const token = await this.getToken(code)
|
|
|
|