ui-calendar icon indicating copy to clipboard operation
ui-calendar copied to clipboard

eventSource is a restfull service with JWT token

Open razor9999 opened this issue 10 years ago • 3 comments

my calendar has to get data from a internal service with JWT token requirement. is there any method to custom http request header? E,g

$scope.eventSource = {
    url: $scope.dataBaseServiceUrl + 'calendar',
    className: 'gcal-event', // an option!
    currentTimezone: 'UTC', // an option!,
    cache: false,

// header:{Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6Ik....'}

};

razor9999 avatar Dec 04 '15 15:12 razor9999

Hi razor9999, In order to add the access_token in the header you can try to do as below:

eventSources: [
                    {
                        url: '/api/calendar',
                        headers: {
                            'Authorization': 'Bearer' + $rootScope.access_token
                        }
                    }
                ]

morganseznec avatar Feb 05 '16 10:02 morganseznec

Don't forget the single whitespace between 'Bearer' and the token.

hnitzsche avatar Jul 18 '17 13:07 hnitzsche

eventSources: [ { url: '/api/calendario', headers: { 'Authorization': 'Bearer ' + jwtoken } } ],

Hello, I tried to use your example with a laravel application. My route is defined in middleware that requires authentication. If you remove the request in api works correctly

stephanesoares avatar Nov 04 '19 18:11 stephanesoares