You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Just want to inform you like I tried other test cases to fetch data using token but it does not work. Is there any solution?
Test Case 1: Use Access Token
constdrupal=newDrupalClient(baseUrl,{fetch: (url,options)=>{options.headers={
...options.headers={Authorization: `Bearer ${getToken.access_token}`}};returnfetch(url,options)}});'тип Error: Failed to fetch JSON:API index at <baseurl>/jsonapi - Unexpected token '<', "<!DOCTYPE "... is not valid JSON'
Test Case 2:
constdrupal=newDrupalClient(baseUrl,{auth: {access_token: getToken.access_token,token_type: getToken.token_type,expires_in: getToken.expires_in,},});'тип Error: Failed to fetch JSON:API index at<baseurl>/jsonapi - Unexpected token '<', "<!DOCTYPE "... is not valid JSON'
Test Case 3
constdrupal=newDrupalClient(baseUrl,{auth: {token: {access_token: getToken.access_token,token_type: getToken.token_type,expires_in: getToken.expires_in,}},});`тип Error: 'clientId' and 'clientSecret' are required for auth. See https://next-drupal.org/docs/client/auth at BlogPage (./app/mynews/page.jsx:74:20)`
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
The text was updated successfully, but these errors were encountered: