invalidOAuthRequest () { if (!this.params.client_id) return this.error('invalid_request', 'Required parameter "client_id" is missing'); if (!this.params.response_type) return this.error('invalid_request', 'Required parameter "response_type" is missing'); if (!this.params.scope) return this.error('invalid_scope', 'Parameter "scope" is invalid'); if (!this.params.redirect_uri) return this.error('invalid_request', 'Required parameter "redirect_uri" is missing'); var uri = url.parse(this.params.redirect_uri); if (!uri.protocol || !uri.hostname) return this.error('invalid_request', 'Parameter "redirect_uri" must be a valid URL'); if (this.params.response_type !== 'token') { return this.error('unsupported_response_type', 'Response type "' + this.params.response_type + '" is not supported'); } return false; }
showForm (username) { if (this.redirectToSSL()) return; if (this.invalidUser(username)) return; if (this.invalidOAuthRequest()) return; this.renderHTML(200, 'auth.html', { title: 'Authorize', client_host: url.parse(this.params.redirect_uri).host, client_id: this.params.client_id, redirect_uri: this.params.redirect_uri, response_type: this.params.response_type, scope: this.params.scope || '', state: this.params.state || '', permissions: this.parseScope(this.params.scope || ''), username: username, access_strings: accessStrings }); }
const token = await this.server._store.authorize(params.client_id, username, permissions);//, (error, token) => { const args = { access_token: token,
t.equals(parsedUrl.scope, 'email offline_access openid', 'initial url: scope') t.equals(parsedUrl.response_type, 'code', 'initial url: response type') t.equals(parsedUrl.client_id, 'Ib0SpoV1Cx3hRaYEVJU523ZjFxmZYzfT', 'initial url: client id') t.equals(parsedUrl.code_challenge.length, 43, 'initial url: code challenge') t.equals(parsedUrl.code_challenge_method, 'S256', 'initial url: client id')