node-sp-auth icon indicating copy to clipboard operation
node-sp-auth copied to clipboard

Undefined access token

Open mmorandini opened this issue 4 years ago • 3 comments

When calling the getAuth() method in my integration (which has always worked until today), the headers object has Bearer undefined as value for the Authorization key.

As I said, the integration has always worked until today, which leaves me very confused.

mmorandini avatar Oct 28 '21 19:10 mmorandini

Also worth noting that no errors are thrown whatsoever. Everything seems to be working fine, except the access token comes back as undefined.

mmorandini avatar Oct 29 '21 11:10 mmorandini

Following an answer in Gitter:

mmorandini @mmorandini 14:37

Hello everyone, I have been experiencing a strange issue with the node-sp-auth package and I am hoping to get some help here hopefully. The issue is that when calling the getAuth() with client_id and client_secret only, everything seems to be working ok (in that I don't get any errors back), but when the promise resolves, the access token comes back as undefined, so the "headers" object looks like this: {'Authorization': 'Bearer undefined'}. Do you have any idea as to why this could be happening? Also worth mentioning that I have been observing this behavior only since yesterday, and that my integration was working fine before.

Andrew Koltyakov @koltyakov 14:53

Hi @mmorandini, did you prolongate the add in? By default an add-in registration is actual per a year, then needed secret update. https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in

We may also add a fast fail check to the auth strategy for future, yet I have no outdated add-in to check at the moment.

koltyakov avatar Oct 29 '21 12:10 koltyakov

Hi @koltyakov thanks for your help. I guess that would help should anyone have the same issue in future. Should I close the issue anyway?

mmorandini avatar Oct 29 '21 12:10 mmorandini