Please specify what version of the library you are using: [ latest ]
Authentication should be successfull.
Error: Error making HttpClient request in queryable [401] Unauthorized ::> {"error_description":"Unsupported security token."} is thrown
I use the simple setup for accessing a sharepoint as described in the documentation:
```
import { SPFetchClient } from "@pnp/nodejs-commonjs";
import { sp } from "@pnp/sp-commonjs";
sp.setup({
sp: {
fetchClientFactory: () => {
return new SPFetchClient(BASE_URL, CLIENT_ID, CLIENT_SECRET);
},
},
});
sp.web.get()
.then( w=> {
console.log("Url : " + w.Url);
console.log("Title : " + w.Title +"\nDesc: " + w.Description);
console.log(JSON.stringify(w));
})
.catch((e) => {
console.log(e);
});
```
Hi @rohansaw,
Definitely not a bug in the library. Legacy Add-In Only auth didn't change in years.
Is it SharePoint Online or On-Prem? Add-In Only auth won't work in On-Prem.
If it's SPO, I assume then a German cloud, then please check you are providing SPOAuthEnv.Germany
Hi, actually really was my mistake. I thought it was almost impossible to do something wrong in this few lines of code, but i acutally had a typo in my client-id and got confused by the error that was raised.
No problem, thanks for coming back with the update! Happy holidays!
Most helpful comment
Hi, actually really was my mistake. I thought it was almost impossible to do something wrong in this few lines of code, but i acutally had a typo in my client-id and got confused by the error that was raised.