Skip to main content
Share Your Experience: Take the 2024 Developer Survey
6 votes
Accepted

Authenticate using OAuth

I think you're desire to use Oauth is justified. However, if you have no other options, you can use Cookie authentication. I have used it before and have heard of people using it as well. Here are ...
Jigarius's user avatar
  • 3,109
5 votes
Accepted

Integration with Single Page Application (React)

To provide the page hosting the React SPA, you will need to implement a custom module. This module would also contains all the JavaScript code of your application. If that's the only usage of React in ...
Pierre Buyle's user avatar
  • 11.4k
4 votes

REST login problem

Solution found! In Postman: method: POST endpoint: http://{your_url}/user/login?_format=json in section Header: Content-Type: application/json in section body: {"name":"admin","pass": "admin"} ...
Fabio Marsigliano's user avatar
4 votes
Accepted

Are passwords entered in the login form encrypted?

When you submit the form on /user/login, the fields are both sent in plaintext in the POST body. If you use a browser debugger (like Chrome Inspector), you can look at the network traffic and see ...
mpdonadio's user avatar
  • 38k
4 votes
Accepted

"There have been more than 5 failed login attempts for this account. It is temporarily blocked." and the flood table is empty

When you have installed Redis the database content for caching, flooding, locking and queuing will be stored in the in-memory database and you have to look there to find this data.
4uk4's user avatar
  • 100k
3 votes
Accepted

Google OAuth Login Solutions?

It looks like the Social API stack is the solution going forward in D8: https://www.drupal.org/project/social_api https://www.drupal.org/project/social_auth https://www.drupal.org/project/...
drastik's user avatar
  • 166
3 votes
Accepted

How do I get the currently logged-in user?

How do I get the currently logged-in user ID in the controller class? Controllers have a currentUser method: public function filtrer($firstLetter='', $nbr_ligne='') { $current_user_id = $this->...
Clive's user avatar
  • 167k
3 votes
Accepted

How to securely authenticate content embeded in another site?

1- build the content structure well in your first site and create a view from admin/structure/views/add that return the data needed to the second site which acts like a client consuming your first ...
Mohammed Gomma's user avatar
3 votes

User login API for social login from mobile apps

I was also looking for functionality that you needs, but after wards i tried to implement service for social sign in using Hybridauth module and i succeed. Try this https://github.com/rathodhiren9/...
hiren rathod's user avatar
3 votes
Accepted

What's the quivalent of node_access()?

You want Node::access(): if ($node->access('view', \Drupal::currentUser())) { // User is allowed to view the node. }
Jaypan's user avatar
  • 17.6k
3 votes

Locked out of my locally hosted Drupal site

Since you are using Acquia Dev Desktop on a Mac, you have access to the best Drupal tool - Drush. In a terminal, navigate to the folder containing your Drupal website and run drush uli It will ...
hansfn's user avatar
  • 1,663
3 votes

AccessDeniedHttpException on a route with _access: TRUE

I'm not sure about how to accept any password. But there is a difference between the default user authentication and basic_auth you are probably using for this route. The first one is defined as ...
4uk4's user avatar
  • 100k
3 votes
Accepted

The username used for a failed login attempt is not reported anymore

Yes, it is correct to say that the username is logged only when there is an account matching that username. That is what UserLoginForm::validateFinal() does. // Use $form_state->getUserInput() in ...
apaderno's user avatar
  • 97.5k
3 votes

All users can't login

From https://www.drupal.org/node/3322420 Password hashing is changed When a site updates to Drupal 10.1.0 or later, a database-update function installs the Password Compatibility module. This allows ...
Joost's user avatar
  • 1,348
2 votes
Accepted

Redirect user back to the private page after they have logged in

For logindestination to work properly all you need to do is add an entry using <current> as the redirect location. Leave the "Redirect to Page" option as Internal page or external URL. This ...
Patrick Ryan's user avatar
  • 2,226
2 votes

How to install oAuth using PHP 7 and PECL OAuth library?

Well, while I have no final solution, since I humbled over the same issue 2 years later today, I can at least put some more light on it and help with some more tests, etc. First things first: There ...
nilsun's user avatar
  • 577
2 votes

Sign out not working properly in OpenID Connect

The openid_connect module is great for authenticating/adding users via external identity providers. However, it does not provide single sign out capabilities. You will have to implement them yourself....
Mario Steinitz's user avatar
2 votes

Cannot log in as Drupal admin

Drupal 7 and 8 do not use a straight md5 password hash. The hash includes a site specific "salt" string that is created with you set up the site. This is in the settings.php file generally. To use ...
CG Monroe's user avatar
  • 3,056
2 votes
Accepted

User login through JSON request returning HTML instead of JSON

It turned out that the Redirect after login module was redirecting to the given URL, which resulted in HTML being output. I have disabled that and now I am getting the proper JSON response.
InspiredCoder's user avatar
2 votes
Accepted

Generate new bearer token with simple_oauth programmatically?

I assume you need an access token for some API call, so to have it generated automatically when you call some API method in your service. I usually go with the following set up: Install kamermans/...
Alex Kuzava's user avatar
  • 1,086
2 votes

How do I restrict GraphQL access with Basic Auth?

I got it! I needed to add $route->setRequirements(['_user_is_logged_in' => 'TRUE']); ...And then do the curl request with the username and password.
pmagunia's user avatar
  • 697
2 votes
Accepted

How to get current user jwt token?

The code shown on comment #2 in Get the token bearer with the JWT module after log in rest method is the code for an event subscriber class. What that comment doesn't show is the definition of the ...
apaderno's user avatar
  • 97.5k
2 votes

How to make users stay logged in across devices?

No, not really. There is no practical way to share the same session between devices or between different browsers on the same device. If you wish to ease transition between devices, a single sign on (...
mona lisa's user avatar
  • 5,950
2 votes
Accepted

Authentication from a dynamically generated form

Roles are config, whereas routes are code. As such, it's generally better to set a route to a permission, which is code based, rather than a role, so that both the route and permission are controlled ...
Jaypan's user avatar
  • 17.6k
2 votes
Accepted

Problem with refreshing the access token

I have got it working with the following steps: In the Auth strategy in nuxt.config.js Set the refresh path to /oauth/token (I also added a query string, ?refresh to distinguish out from the login ...
dfd's user avatar
  • 21
2 votes
Accepted

Cookie authentication when reguistering users through REST API

When you perform a login using the login endpoint you'll get a cookie back (as well as a CSRF token) which you can then use for subsequent requests instead of doing a fresh login every time. So with ...
Lambic's user avatar
  • 718
2 votes
Accepted

How can I set view permissions for content type to make it visible to autenticated users only?

Drupal core doesn't come with the separate "View content" permission. To get that functionality you need to search for a module that adds it. I think all the contributed modules that provide ...
prkos's user avatar
  • 7,131
2 votes

Adding role to a user after login - after simplesamlphp/externalauth

You can: Assign them via the module's configuration, if they are listed by the Identity Provider. Go to admin/config/people/simplesamlphp_auth/sync and configure Automatic role population from ...
Giuseppe's user avatar
  • 971
2 votes

RestUI: The used authentication method is not allowed on this route

I can't believe it... The problem was that I created a /node Page, with content: <script>window.location = '/some-redirect'</script> and assigned that as the front page. This is perfectly ...
Victor Pudeyev's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible