nl_tokens: Call a api request and set Auth header @param { Object } options - { method token route external form headers } @param { Object } params @param { Object } body @param { Object } headers @param { String } customToken
pl_tokens: function requestWithToken ( options , params , body = { } , headers = { } , customToken = null , tokenType = 'Bearer' ) { const cloned = cloneDeep ( options ) ; if ( params ) { cloned . route = parameterizeRoute ( cloned . <mask> , params ) ; } const requestHeaders = Object . assign ( { } , headers , { Authorization : ( done ) => { if ( customToken !== null ) { done ( ` ${ tokenType } ${ customToken } ` ) ; } else { Storage . getToken ( options . storageOveride ) . then ( ( storedToken ) => { done ( ` ${ tokenType } ${ storedToken } ` ) ; } ) ; } } , } ) ; return callRequest ( cloned , body , requestHeaders ) ; }