Calling service method and using it in the interceptor correct


My idea was to create one service method called loggedIn() which i want to call in the interceptor. The loggedIn() service method should deliver a valid token which is available in the localStorage. In addition to the existence i want to check the validity of that token bei calling the verifytoken API from the server. The post call in the verifytoken Method within the service will do that.

As you can see in the code that i am calling the verifytoken service method within the loggedIn(). Is this a valid approach to call incident methods of the same service ?

As the loggedIn() will deliver the verifytoken result async, is there a need to subrcribe to loggedIn() service method when calling it in the interceptor ?

in my service:

       loggedIn(): string{           let tok = localStorage.getItem('token');           if (tok=== null || tok === undefined || tok === ""){             return "";           }else{             //return tok;              this.verifyToken(tok).subscribe(               res => {                 console.log(res);                 console.log(res.success);                 return tok;               },               err => {                 console.log(err);                 return "";               }             )             }         }         verifyToken( tok: string ){           let headers = new HttpHeaders({             'Content-Type': 'application/json',             'Authorization': tok });           let options = { headers: headers };           return this.http.post<any>(this.verifyUrl, "", options );       } 

In my interceptor:

    intercept(req, next){       //Interceptor ausschliessen       const exclude = "/verifytoken";       console.log('Exclude' +req.url.search(exclude));       console.log('Req '+req.url);        let tokenizedRequest = req;        if (req.url.search(exclude)===-1){         //req clonen und mit header anreichern         let mytoken = this.authServ.loggedIn();         console.log('Token im Intercept '+mytoken);         tokenizedRequest = req.clone({           setHeaders: {             Authorization: mytoken           }         });             }       return next.handle(tokenizedRequest);     }