bitrix icon indicating copy to clipboard operation
bitrix copied to clipboard

access_token on Bitrix instance not working (always 401)

Open mruniverse opened this issue 2 years ago • 11 comments

I've already tested in other versions and it works fine.

mruniverse avatar Sep 20 '23 20:09 mruniverse

Hi! Do you mean other versions of this library or some other packages? Can you provide an example that leads to an error? Be careful not to expose you access_token

mrhyde avatar Sep 20 '23 20:09 mrhyde

Other versions of this library. Sure! i'm going to prepare an example in just a moment.

mruniverse avatar Sep 21 '23 13:09 mruniverse

I have the same problem. Always returns Response code 401 (Unauthorized) The token is definitely valid, because if you use the Bitrix API, there is no such error.

  import { Bitrix } from '@2bad/bitrix'

  const access_token = "7fe33a650068085800680852000000010000";
  const bitrix_service = Bitrix('https://b24-6.bitrix24.ru/rest', access_token)
   
bitrix_service.deals
    .get("1")
    .then(({ result }) => {
const { TITLE } = result; 
      console.log(TITLE);
    })
    .catch(console.error);

foresh9 avatar Oct 27 '23 09:10 foresh9