|
|
@ -119,10 +119,10 @@ class OAuth2Service extends SiteService { |
|
|
|
var code = uuidv4(); |
|
|
|
var ac = new OAuth2AuthorizationCode({ |
|
|
|
code, |
|
|
|
clientId: client.id, |
|
|
|
clientId: client._id, |
|
|
|
redirectUri, |
|
|
|
user: user.id, |
|
|
|
scope: ares.scope, |
|
|
|
user: user._id, |
|
|
|
scopes: client.scopes, |
|
|
|
}); |
|
|
|
await ac.save(); |
|
|
|
return done(null, code); |
|
|
@ -178,7 +178,7 @@ class OAuth2Service extends SiteService { |
|
|
|
|
|
|
|
clientDefinition.secret = generatePassword(PASSWORD_LEN, false); |
|
|
|
clientDefinition.coreAuth.scopes = clientDefinition.coreAuth.scopes.map((scope) => striptags(scope)); |
|
|
|
clientDefinition.coreAuth.redirectUri = striptags(clientDefinition.coreAuth.redirectUri); |
|
|
|
clientDefinition.coreAuth.callbackUrl = striptags(clientDefinition.coreAuth.callbackUrl); |
|
|
|
|
|
|
|
/* |
|
|
|
* Use an upsert to either update or create the OAuth2 client record for the |
|
|
@ -203,7 +203,7 @@ class OAuth2Service extends SiteService { |
|
|
|
'site.company': clientDefinition.company, |
|
|
|
secret: clientDefinition.secret, |
|
|
|
scopes: clientDefinition.coreAuth.scopes, |
|
|
|
redirectUri: clientDefinition.coreAuth.redirectUri, |
|
|
|
callbackUrl: clientDefinition.coreAuth.callbackUrl, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|