Skip to content

Bearer Access Token Authentication does not work. #825

Open
@ankitparmar14190

Description

@ankitparmar14190

Package

next-drupal (NPM package)

Ask the question

Access Token does not work.

I have used Access Token authentication to fetch data with secure API but getting below error.
Error: Failed to fetch JSON:API index at <base_url>/jsonapi

Could you please help me over here? Am I missing something to add here?

Note:- This is working without authentication. But we enable authentication it does not work. Token is generating correct. I tried with postman.

Here is my code

const getToken = await fetchToken();

  const drupal = new DrupalClient(baseUrl, {
    auth: {
      access_token: getToken.access_token,
      token_type: getToken.token_type,
      expires_in: getToken.token_type
    },
  });
  
  const articles = await drupal.getResourceCollection("node--news", {
    withAuth: {
      access_token: getToken.access_token,
      token_type: getToken.token_type,
      expires_in: getToken.expires_in
    },
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion asked by a usertriageA new issue that needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions