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 ...
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 ...
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"}
...
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 ...
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.
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 ...
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.
}
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->...
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 ...
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/...
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 ...
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 ...
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
...
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....
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 ...
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.
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 ...
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/...
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.
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 ...
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 (...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
Accepted
What is correct api key name in headers
The code that looks for the API key is in ApiKeyAuth::getKey().
public function getKey(Request $request) {
$form_api_key = $request->get('api_key');
if (!empty($form_api_key)) {
...
1
vote
How to get user data/authenticate with bearer token - Simple OAuth - Decoupled
I'm not familiar with the Nuxtjs framework discussed in the tutorial you linked to, but basically once you have the access_token the user should be authenticated in Drupal. It should be enough that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
authentication-authorization × 386users × 106
7 × 97
8 × 53
social-network × 24
services × 21
9 × 15
6 × 9
hooks × 9
views × 8
security × 8
10 × 8
theming × 7
javascript × 7
cookies × 7
forms × 6
feeds × 6
commerce × 5
rules × 5
routes × 5
emails × 5
redirection × 5
tokens × 5
sessions × 5
entities × 4