getAuthorizationHeader
Returns an authorization header based on an authentication method.
const paths = await drupal.getAuthorizationHeader( auth): Promise<string>
auth: NextDrupalAuth
- Required
- A supported authentication method. See auth
Examples
- Auth method:
Bearer
. For this, you need aclientId
andclientSecret
const auth = { clientId: process.env.DRUPAL_CLIENT_ID, clientSecret: process.env.DRUPAL_CLIENT_SECRET,}
const authorizationHeader = await drupal.getAuthorizationHeader(auth)
// authorizationHeader = Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjM .........