OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
74 stars 23 forks source link

[Bug]: PATCH https://onesignal.com/api/v1/apps/0394ad42-94df-449b-a1a8-17c5ab498c35/users/by/onesignal_id/ecde98c4-64e0-4a9a-8225-1bf20814dedf/identity 401 (Unauthorized) #127

Closed arianshirepublik closed 7 months ago

arianshirepublik commented 8 months ago

What happened?

react-onesignal": "^3.0.1",

When I am using import OneSignal from 'react-onesignal'

OneSignal.login(id, token.oneSignalUserIdToken)

new user login show error:

instrument.js:131 PATCH https://onesignal.com/api/v1/apps/0394ad42-94df-449b-a1a8-17c5ab498c35/users/by/onesignal_id/ecde98c4-64e0-4a9a-8225-1bf20814dedf/identity 401 (Unauthorized) (anonymous) @ instrument.js:131 (anonymous) @ OneSignalApiBase.js:68 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 executeFetch @ OneSignalSDK.page.es6.js?v=160002:1 call @ OneSignalApiBase.js:56 patch @ OneSignalApiBase.js:24 (anonymous) @ RequestService.js:63 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 addAlias @ OneSignalSDK.page.es6.js?v=160002:1 (anonymous) @ LoginManager.js:196 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 identifyUser @ OneSignalSDK.page.es6.js?v=160002:1 (anonymous) @ LoginManager.js:141 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 identifyOrUpsertUser @ OneSignalSDK.page.es6.js?v=160002:1 (anonymous) @ LoginManager.js:71 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 r @ tslib.es6.js:118 Promise.then (async) l @ tslib.es6.js:120 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 login @ OneSignalSDK.page.es6.js?v=160002:1 (anonymous) @ OneSignal.js:91 (anonymous) @ tslib.es6.js:121 o @ tslib.es6.js:117 login @ OneSignalSDK.page.es6.js?v=160002:1 (anonymous) @ index.es.js:95 processItem @ ProcessOneSignalPushCalls.js:5 push @ OneSignal.js:229 push @ OneSignalDeferred.js:7 (anonymous) @ index.es.js:94 oneSignalLogin @ index.es.js:88 setWebPushNotificationsExternalUserId @ webPushNotifications.ts:36 await in setWebPushNotificationsExternalUserId (async) (anonymous) @ webPushNotifications.ts:20 Promise.then (async) webPushNotificationsInit @ webPushNotifications.ts:19 onSuccess @ Confirm.tsx:105 await in onSuccess (async) execute @ index.production.js:831 await in execute (async) mutate @ index.production.js:1501 (anonymous) @ index.production.js:1926 onSubmit @ Confirm.tsx:126 await in onSubmit (async) (anonymous) @ index.esm.mjs:1801 await in (anonymous) (async) callCallback @ react-dom.development.js:3733 sentryWrapped @ helpers.js:77 invokeGuardedCallbackDev @ react-dom.development.js:3777 invokeGuardedCallback @ react-dom.development.js:3834 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:3848 executeDispatch @ react-dom.development.js:7992 processDispatchQueueItemsInOrder @ react-dom.development.js:8018 processDispatchQueue @ react-dom.development.js:8029 dispatchEventsForPlugins @ react-dom.development.js:8038 (anonymous) @ react-dom.development.js:8198 batchedUpdates$1 @ react-dom.development.js:22595 batchedUpdates @ react-dom.development.js:3581 dispatchEventForPluginEventSystem @ react-dom.development.js:8197 dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:5703 dispatchEvent @ react-dom.development.js:5697 dispatchDiscreteEvent @ react-dom.development.js:5674 sentryWrapped @ helpers.js:77 instrument.js:103 Login: Error while identifying/upserting user: identifyUser: malformed request: {"errors":[{"code":"auth-1","title":"This operation requires 'Authorization' in the HTTP header"}]}

image

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

macOS Ventura 13.0

Steps to reproduce?

new user login show error:

instrument.js:131     PATCH https://onesignal.com/api/v1/apps/0394ad42-94df-449b-a1a8-17c5ab498c35/users/by/onesignal_id/ecde98c4-64e0-4a9a-8225-1bf20814dedf/identity 401 (Unauthorized)
(anonymous) @ instrument.js:131
(anonymous) @ OneSignalApiBase.js:68
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
executeFetch @ OneSignalSDK.page.es6.js?v=160002:1
call @ OneSignalApiBase.js:56
patch @ OneSignalApiBase.js:24
(anonymous) @ RequestService.js:63
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
addAlias @ OneSignalSDK.page.es6.js?v=160002:1
(anonymous) @ LoginManager.js:196
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
identifyUser @ OneSignalSDK.page.es6.js?v=160002:1
(anonymous) @ LoginManager.js:141
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
identifyOrUpsertUser @ OneSignalSDK.page.es6.js?v=160002:1
(anonymous) @ LoginManager.js:71
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
r @ tslib.es6.js:118
Promise.then (async)
l @ tslib.es6.js:120
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
login @ OneSignalSDK.page.es6.js?v=160002:1
(anonymous) @ OneSignal.js:91
(anonymous) @ tslib.es6.js:121
o @ tslib.es6.js:117
login @ OneSignalSDK.page.es6.js?v=160002:1
(anonymous) @ index.es.js:95
processItem @ ProcessOneSignalPushCalls.js:5
push @ OneSignal.js:229
push @ OneSignalDeferred.js:7
(anonymous) @ index.es.js:94
oneSignalLogin @ index.es.js:88
setWebPushNotificationsExternalUserId @ webPushNotifications.ts:36
await in setWebPushNotificationsExternalUserId (async)
(anonymous) @ webPushNotifications.ts:20
Promise.then (async)
webPushNotificationsInit @ webPushNotifications.ts:19
onSuccess @ Confirm.tsx:105
await in onSuccess (async)
execute @ index.production.js:831
await in execute (async)
mutate @ index.production.js:1501
(anonymous) @ index.production.js:1926
onSubmit @ Confirm.tsx:126
await in onSubmit (async)
(anonymous) @ index.esm.mjs:1801
await in (anonymous) (async)
callCallback @ react-dom.development.js:3733
sentryWrapped @ helpers.js:77
invokeGuardedCallbackDev @ react-dom.development.js:3777
invokeGuardedCallback @ react-dom.development.js:3834
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:3848
executeDispatch @ react-dom.development.js:7992
processDispatchQueueItemsInOrder @ react-dom.development.js:8018
processDispatchQueue @ react-dom.development.js:8029
dispatchEventsForPlugins @ react-dom.development.js:8038
(anonymous) @ react-dom.development.js:8198
batchedUpdates$1 @ react-dom.development.js:22595
batchedUpdates @ react-dom.development.js:3581
dispatchEventForPluginEventSystem @ react-dom.development.js:8197
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:5703
dispatchEvent @ react-dom.development.js:5697
dispatchDiscreteEvent @ react-dom.development.js:5674
sentryWrapped @ helpers.js:77
instrument.js:103 Login: Error while identifying/upserting user: identifyUser: malformed request: {"errors":[{"code":"auth-1","title":"This operation requires 'Authorization' in the HTTP header"}]}
<img width="979" alt="image" src="https://github.com/OneSignal/react-onesignal/assets/133647949/503d86cb-0449-49f0-a0ce-193473f0e1b5">

What did you expect to happen?

we can log in correctly and then perform personalized push

Relevant log output

No response