Score:0

Get client credentials from Simple Oauth module

I am creating user authentification with Drupal 9 + NuxtJS. Using Simple Oauth module and create post requests to

oauth/token

with data

const data = {
  grant_type: 'password',
  client_id: '',
  client_secret: '!',
  username: username,
  password: password,
}

So, how can I get this client_id, client_secret to past it in JS file ?

Score:0
cn flag

Maybe these following modules will help you, I was once stuck with the same issue for the authentication. My Drupal application was decoupled (Frontend - Vue and Backend - Drupal 9)

I installed the following contributed modules: JWT, and Get JWT on Login.

And just call the login (https://your-drupal-site/user/login?_format=json) endpoint with provided credentials, it will send you back the user's details:

{
    "current_user": {
        "uid": "1",
        "name": "admin"
    },
    "csrf_token": "UlGb7fak5ZS-r1BRistBh4IWLm_Z7F1xMpY3KYTGqcU",
    "logout_token": "7AvbnHgr9iDxIDVertHTI3PMX2-Shd6sjuN8hNHrHv8F",
    "access_token": "eyJ0eXAiOiJKV1QiLDJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1NDg2NzA3NDUsImV4cCI6MTU0ODY3NDM0NSwiZHJ1cGAsIjp7InVpZCI6IjYifX0.cnG6atSLYrRh6D05LZg9RwrJJdYoJfTBXTUZboPhJH3lYf640FmQTkJwwy9E8kg7ot59qyb5qtgIewM3R1KCDw"
}
Thanks! I will try
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.