auth0 / angular2-jwt

Helper library for handling JWTs in Angular apps
MIT License
2.63k stars 490 forks source link

"Authorization": "Bearer" is not attached in delete requests. #621

Closed r0boto closed 4 years ago

r0boto commented 4 years ago

When I Trying to send a delete request I have to add additional bearer token manually into delete request because auth header is not attached automatically. It is a bug or me forgot some config params in Jwt Factory?

Ionic:

   Ionic CLI                     : 5.4.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.1.1
   @capacitor/core : 1.1.1

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (/usr/local/bin/node)
   npm    : 6.9.0
export function jwtOptionsFactory(authSvc) {
    return {
        tokenGetter: () => {
            const token = authSvc.getToken();
            return token;
        },
        whitelistedDomains: Constants.WHITELISTED_DOMAINS,
        blacklistedRoutes: Constants.BLACKLISTED_ROUTES,
        throwNoTokenError: false,
    };
}
    unRegisterDeviceFromPushNotifications$(deviceEntry: DeviceEntry, userToken: string) {
        console.log("unRegisterDeviceFromPushNotifications");
        const options = {
            headers: new HttpHeaders({
                "Content-Type": "application/json",
                "Authorization": "Bearer " + userToken, //NOTE: Authorization header is not
            }),
            body: deviceEntry,
        };
        return this.http.delete("/common/PushNotifications", options).subscribe(
                result => console.log(result),
                err => console.error(err)
            );
    }
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️