Click here to Skip to main content
15,885,032 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: python webdevelopment Pin
Nathan Minier25-May-18 1:25
professionalNathan Minier25-May-18 1:25 
QuestionInformation about wordpress Pin
Max Power Marketing, LLC10-May-18 21:51
Max Power Marketing, LLC10-May-18 21:51 
AnswerRe: Information about wordpress Pin
Richard MacCutchan11-May-18 3:12
mveRichard MacCutchan11-May-18 3:12 
AnswerRe: Information about wordpress Pin
wyzrahman14-May-18 10:49
wyzrahman14-May-18 10:49 
QuestionHow Do I Design This Simple (yet Responsive) Site...??? Pin
Member 1208020110-May-18 12:43
Member 1208020110-May-18 12:43 
AnswerRe: How Do I Design This Simple (yet Responsive) Site...??? Pin
Richard Deeming11-May-18 1:37
mveRichard Deeming11-May-18 1:37 
AnswerRe: How Do I Design This Simple (yet Responsive) Site...??? Pin
jkirkerx27-May-18 19:13
professionaljkirkerx27-May-18 19:13 
QuestionFixing a Broken Interceptor Pin
cjb1108-May-18 3:50
cjb1108-May-18 3:50 
We're developing a Angular 1 site that talks to a .NET WebAPI2 api. We have an interceptor related to the authentication side, but we're having problems with it. We are using a loading bar Angular component, and that component is reporting that the interceptor is broken. But we're not sure where/why and worse where to start investigating.

By simple code elimination, the _request method seems to be ok (or at least doesn't cause issues, it might still be bad code!)
Its the _responseSuccess method that causes the problem.

'use strict';
app.factory('authInterceptorService', ['$injector', '$q', '$location', 'localStorageService', function ($injector, $q, $location, localStorageService)
{

    var authInterceptorServiceFactory = {};

    function RequiresRefresh(responseURL)
    {
        if (responseURL.indexOf('getcutofftime') > -1)
            return false;
        if (responseURL.indexOf('resources') !== -1)
            return true;
        return false;
    }

    var _request = function (config)
    {
        config.headers = config.headers || {};

        var authData = localStorageService.get('authorizationData');
        if (authData)
        {
            config.headers.Authorization = 'Bearer ' + authData.token;
        }

        return config || q$.when(config);
    };

    //should handle all error responses in here.
    //var _responseError = function (rejection)
    //{
    //    console.log("Intercepted Rejection: " + rejection);

    //    return $q.reject(rejection);
        
    //};

    var _responseSuccess = function (response)
    {
        var responseURL = response.config.url;
        if (responseURL !== null && typeof responseURL !== 'undefined')
        {
            //check to make sure it's actually an interaction with the resourcesAPI - these are the only times it should refresh the token.
            if (RequiresRefresh(responseURL))
            {
                //get a new token!
                var authData = localStorageService.get('authorizationData');

                var JSONdata = {
                    windowsFullName: authData.windowsFullName
                    , windowsUserName: authData.windowsUserName
                    , summitUserName: authData.summitUserName
                    , summitFullName: authData.summitFullName
                    , clientID: 'MatterhornAuthApp'
                };

                $injector.get("$http")
                    .post(serviceBase + 'usermanagement/account/ReissueToken', JSONdata, { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + authData.token } })
                    .then(function (response)
                    {
                        response = response.data;
                        localStorageService.set('authorizationData', {
                            token: response.protectedTicket
                            , summitUserName: response.summitUserName
                            , windowsFullName: response.windowsFullName
                            , windowsUserName: response.windowsUserName
                            , summitFullName: response.summitFullName
                            , refreshToken: ""
                            , useRefreshTokens: false
                            , isSummitAuth: authData.isSummitAuth
                            , isWindowsAuth: authData.isWindowsAuth
                            , roles: response.roles
                        });
                    }, function (err)
                    {
                        return $q.reject(err);
                    });
            }
        }

        //request a new token
        var status = response.status;
        return response || $q.when(response);
    };

    authInterceptorServiceFactory.request = _request;
    ////authInterceptorServiceFactory.responseError = _responseError;
    //authInterceptorServiceFactory.response = _responseSuccess;

    return authInterceptorServiceFactory;
}]);


Any help or advice would be appreciated.
QuestionHow to use $_SERVER['PHP_SELF'] to save record and print simultaneouly Pin
Member 136918611-May-18 21:16
Member 136918611-May-18 21:16 
AnswerRe: How to use $_SERVER['PHP_SELF'] to save record and print simultaneouly Pin
Richard MacCutchan1-May-18 22:01
mveRichard MacCutchan1-May-18 22:01 
QuestionHow to run Javascript queries in code (HTML) Pin
Member 1380375629-Apr-18 5:20
Member 1380375629-Apr-18 5:20 
AnswerRe: How to run Javascript queries in code (HTML) Pin
Richard Deeming30-Apr-18 1:12
mveRichard Deeming30-Apr-18 1:12 
QuestionCodeIgniter-Search Pin
Jireh Capao24-Apr-18 19:03
Jireh Capao24-Apr-18 19:03 
QuestionRe-code to get rid of Absolute Positioning? Pin
Member 1208020114-Apr-18 8:16
Member 1208020114-Apr-18 8:16 
AnswerRe: Re-code to get rid of Absolute Positioning? Pin
Blikkies17-Apr-18 22:33
professionalBlikkies17-Apr-18 22:33 
AnswerRe: Re-code to get rid of Absolute Positioning? Pin
Richard Deeming19-Apr-18 2:20
mveRichard Deeming19-Apr-18 2:20 
AnswerRe: Re-code to get rid of Absolute Positioning? Pin
W Balboos, GHB4-May-18 7:05
W Balboos, GHB4-May-18 7:05 
QuestionSaving data submitted online as pdf Pin
Deekkris13-Apr-18 9:23
Deekkris13-Apr-18 9:23 
AnswerRe: Saving data submitted online as pdf Pin
David Mujica17-Apr-18 3:20
David Mujica17-Apr-18 3:20 
QuestionNeed to Link to an Image on another Page already containing multiple images Pin
Member 1208020110-Apr-18 8:03
Member 1208020110-Apr-18 8:03 
AnswerRe: Need to Link to an Image on another Page already containing multiple images Pin
Richard Deeming19-Apr-18 2:07
mveRichard Deeming19-Apr-18 2:07 
QuestionRe: Need to Link to an Image on another Page already containing multiple images Pin
Sarcastic CA20-Apr-18 7:56
professionalSarcastic CA20-Apr-18 7:56 
QuestionUsing DOM with Selector Values, Assignment Pin
Member 137687478-Apr-18 9:10
Member 137687478-Apr-18 9:10 
QuestionHow to perform addition from LineTotal to subtotal using HTML JavaScript Pin
Nikhil Dange21-Mar-18 3:24
Nikhil Dange21-Mar-18 3:24 
SuggestionQuestion about crud operations Pin
Maniteja Attili20-Mar-18 10:25
Maniteja Attili20-Mar-18 10:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.