File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,11 @@ export async function publish<T extends Config>(config: T): Promise<ResponseData
125125
126126 if ( config . authorization ) {
127127 axiosConfig . withCredentials = true ;
128- axiosConfig . auth = config . authorization ;
128+ if ( typeof config . authorization === 'string' ) {
129+ axiosConfig . headers . Authorization = config . authorization ;
130+ } else {
131+ axiosConfig . auth = config . authorization ;
132+ }
129133 }
130134
131135 if ( config . delay ) {
Original file line number Diff line number Diff line change 1- import type { AxiosBasicCredentials as HTTPAuth , Method as HTTPMethod } from 'axios' ;
1+ import type { AxiosBasicCredentials , Method as HTTPMethod } from 'axios' ;
22
33export enum MessagePriority {
44 /** Really long vibration bursts, default notification sound with a pop-over notification. */
@@ -141,8 +141,10 @@ export interface BaseConfig {
141141 * Depending on whether the server is configured to support
142142 * [access control](https://docs.ntfy.sh/config/#access-control), some topics may be read/write protected so that only
143143 * users with the correct credentials can subscribe or publish to them.
144+ *
145+ * Use either basic credentials or an access token.
144146 */
145- authorization ?: HTTPAuth ;
147+ authorization ?: AxiosBasicCredentials | string ;
146148 /**
147149 * You can define which URL to open when a notification is clicked. This may be useful if your notification is related
148150 * to a Zabbix alert or a transaction that you'd like to provide the deep-link for. Tapping the notification will open
You can’t perform that action at this time.
0 commit comments