dist/corbel.with-polyfills.js
function(username, password, setCookie, redirect) {
                console.log('oauthInterface.authorization.login', username + ':' + password);

                if (username) {
                    this.params.data.username = username;
                }

                if (password) {
                    this.params.data.password = password;
                }

                this.params.withCredentials = true;
                var that = this;

                // make request, generate oauth cookie, then redirect manually
                return this.request({
                        url: this._buildUri(this.uri + '/authorize'),
                        method: corbel.request.method.POST,
                        data: this.params.data,
                        contentType: this.params.contentType,
                        noRedirect: redirect ? redirect : true
                    })
                    .then(function(res) {
                        if (corbel.Services.getLocation(res)) {

                            var req = {
                                url: corbel.Services.getLocation(res)
                            };

                            if (setCookie) {
                                req.headers = {
                                    RequestCookie: 'true'
                                };
                                req.withCredentials = true;
                            }

                            return that.request(req).then(function(response) {
                                var accessToken = response.data.accessToken || response.data.query.code;
                                that.driver.config.set(corbel.Iam.IAM_TOKEN, response.data);
                                that.driver.config.set(corbel.Iam.IAM_DOMAIN, corbel.jwt.decode(accessToken).domainId);
                                if (that.params.jwt) {
                                    that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, corbel.jwt.decode(that.params.jwt).scope);
                                }
                                if (that.params.claims) {
                                    if (that.params.claims.scope) {
                                        that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, that.params.claims.scope);
                                    } else {
                                        that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, that.driver.config.get('scopes', ''));
                                    }
                                }
                                return response;
                            });
                        } else {
                            return res.data;
                        }
                    });
            }
function(username, password, setCookie, redirect) {
                console.log('oauthInterface.authorization.login', username + ':' + password);

                if (username) {
                    this.params.data.username = username;
                }

                if (password) {
                    this.params.data.password = password;
                }

                this.params.withCredentials = true;
                var that = this;

                // make request, generate oauth cookie, then redirect manually
                return this.request({
                        url: this._buildUri(this.uri + '/authorize'),
                        method: corbel.request.method.POST,
                        data: this.params.data,
                        contentType: this.params.contentType,
                        noRedirect: redirect ? redirect : true
                    })
                    .then(function(res) {
                        if (corbel.Services.getLocation(res)) {

                            var req = {
                                url: corbel.Services.getLocation(res)
                            };

                            if (setCookie) {
                                req.headers = {
                                    RequestCookie: 'true'
                                };
                                req.withCredentials = true;
                            }

                            return that.request(req).then(function(response) {
                                var accessToken = response.data.accessToken || response.data.query.code;
                                that.driver.config.set(corbel.Iam.IAM_TOKEN, response.data);
                                that.driver.config.set(corbel.Iam.IAM_DOMAIN, corbel.jwt.decode(accessToken).domainId);
                                if (that.params.jwt) {
                                    that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, corbel.jwt.decode(that.params.jwt).scope);
                                }
                                if (that.params.claims) {
                                    if (that.params.claims.scope) {
                                        that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, that.params.claims.scope);
                                    } else {
                                        that.driver.config.set(corbel.Iam.IAM_TOKEN_SCOPES, that.driver.config.get('scopes', ''));
                                    }
                                }
                                return response;
                            });
                        } else {
                            return res.data;
                        }
                    });
            }
function ( username , password , setCookie , redirect ) { console . log ( 'oauthInterface.authorization.login' , username + ':' + password ) ; if ( username ) { this . params . data . username = username ; } if ( password ) { this . params . data . password = password ; } this . params . withCredentials = true ; var that = this ; // make request, generate oauth cookie, then redirect manually return this . request ( { url : this . _buildUri ( this . uri + '/authorize' ) , method : corbel . request . method . POST , data : this . params . data , contentType : this . params . contentType , noRedirect : redirect ? redirect : true } ) . then ( function ( res ) { if ( corbel . Services . getLocation ( res ) ) { var req = { url : corbel . Services . getLocation ( res ) } ; if ( setCookie ) { req . headers = { RequestCookie : 'true' } ; req . withCredentials = true ; } return that . request ( req ) . then ( function ( response ) { var accessToken = response . data . accessToken || response . data . query . code ; that . driver . config . set ( corbel . Iam . IAM_TOKEN , response . data ) ; that . driver . config . set ( corbel . Iam . IAM_DOMAIN , corbel . jwt . decode ( accessToken ) . domainId ) ; if ( that . params . jwt ) { that . driver . config . set ( corbel . Iam . IAM_TOKEN_SCOPES , corbel . jwt . decode ( that . params . jwt ) . scope ) ; } if ( that . params . claims ) { if ( that . params . claims . scope ) { that . driver . config . set ( corbel . Iam . IAM_TOKEN_SCOPES , that . params . claims . scope ) ; } else { that . driver . config . set ( corbel . Iam . IAM_TOKEN_SCOPES , that . driver . config . get ( 'scopes' , '' ) ) ; } } return response ; } ) ; } else { return res . data ; } } ) ; }
Does a login in oauth server
@method
@memberOf corbel.Oauth.AuthorizationBuilder
@param  {String} username The username of the user to log in
@param  {String} password The password of the user
@param  {Boolean} setCookie Sends 'RequestCookie' to the server
@param  {Boolean} redirect The user when he does the login
@return {Promise}         Q promise that resolves to a redirection to redirectUri or rejects with a {@link CorbelError}
Does a login in oauth server