next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

To have a method or some helper to get the user access token from drupal

Open joshirohit100 opened this issue 1 year ago • 0 comments

Package

next-drupal (NPM package)

Describe the feature request

I was checking the login flow on nextjs site with next-auth where user needs to login to site using creds. To this, I was checking to getting the access token from drupal. Initially I just did (based on quick checks on helper methods name) -

const drupal = new DrupalClien(options here for password grant and auth);
const token = drupal.getAccessToken()

but seems like ^^ only work for the client_credentials grant.

So it would be helpful to have a method to get the token from drupal rather doing / writing all like https://github.com/chapter-three/next-drupal/blob/main/examples/example-auth/pages/api/auth/%5B...nextauth%5D.ts for credentialHelpers

or refactor getAccessToken() to support this as well

joshirohit100 avatar Dec 05 '23 06:12 joshirohit100