MCPcopy Create free account
hub / github.com/dataease/SQLBot / authorizePassword

Function authorizePassword

frontend/public/swagger-ui-bundle.js:31685–31721  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

31683 },
31684 authorizePassword =
31685 (s) =>
31686 ({ authActions: o }) => {
31687 let {
31688 schema: i,
31689 name: a,
31690 username: u,
31691 password: _,
31692 passwordType: w,
31693 clientId: x,
31694 clientSecret: C,
31695 } = s,
31696 j = { grant_type: 'password', scope: s.scopes.join(' '), username: u, password: _ },
31697 L = {}
31698 switch (w) {
31699 case 'request-body':
31700 !(function setClientIdAndSecret(s, o, i) {
31701 o && Object.assign(s, { client_id: o })
31702 i && Object.assign(s, { client_secret: i })
31703 })(j, x, C)
31704 break
31705 case 'basic':
31706 L.Authorization = 'Basic ' + utils_btoa(x + ':' + C)
31707 break
31708 default:
31709 console.warn(
31710 `Warning: invalid passwordType ${w} was passed, not including client id and secret`
31711 )
31712 }
31713 return o.authorizeRequest({
31714 body: buildFormData(j),
31715 url: i.get('tokenUrl'),
31716 name: a,
31717 headers: L,
31718 query: {},
31719 auth: s,
31720 })
31721 }
31722 const authorizeApplication =
31723 (s) =>
31724 ({ authActions: o }) => {

Callers

nothing calls this directly

Calls 3

utils_btoaFunction · 0.85
buildFormDataFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected