Questions tagged [authentication-authorization]
Use it for the user authentication/authorization on Drupal core or third-party modules.
367
questions
0
votes
0
answers
16
views
How does Redis override Drupal's flood control?
Related question: Why can't I log in when there is no flood table?
I have a Drupal 10 site hosted on PlatformSH that has Redis enabled. I do not have the Redis module enabled. I also haven't ...
3
votes
1
answer
98
views
Check for active/qualified session in EventSubscriber, destroy session and cookies if not
I have an application that has a custom SSO with a third party service. We are porting Drupal 7 code to Drupal 10 to continue the functionality. Previously we had a hook_init function that did the ...
-1
votes
1
answer
38
views
Access arguments only allow administer and user logged in
I am building a module and used the following code to define a route for a user account.
How do I set the access arguments to only allow administrators and the user himself?
$items['user/%/extra-...
0
votes
0
answers
62
views
Clean logout from REST service
Considering that none of the usual suggestions really work...
How do I log out with REST?
Logout using REST
Fix for "'csrf_token' URL query argument is invalid" error during logout
...
0
votes
0
answers
38
views
TFA Session expired when user login
not sure if anyone faces this issue, when I tried to login with the authentication. It shows TFA session has expired. But the user account was logged in. Screenshot attached, I tried to drupal set ...
0
votes
1
answer
97
views
Adding role to a user after login - after simplesamlphp/externalauth
Adding more context to my question
here is the scenario:
a) the organization has different departments
b) actual Drupal roles are not assigned through simplesaml role attribute but through simplesaml ...
0
votes
0
answers
70
views
403 Forbidden after 10 POSTs
Problem/Motivation
Repeated posting a redhen_contact via the Drupal JSON:API succeeds for exactly 10 times in a row. The 11th attempt fails with 403 status code.
After waiting for 60-120 seconds, the ...
-1
votes
1
answer
149
views
"No route found for GET" on custom REST resource when posting
I'm seeing really weird behavior. I've created a custom REST resource at the route /user/login-special.
This is a passwordless login resource, so I pass the mail address and then get a response that ...
1
vote
1
answer
225
views
How can I set view permissions for content type to make it visible to autenticated users only?
I want a content type to be only visible to authenticated users.
Now the edit permission dialog only offers permissions for modification, not for displaying the published content.
Until Drupal 9, I've ...
0
votes
1
answer
69
views
401 error when trying to retrieve OAuth authorization code
I'm building a decoupled Next.js frontend to consume data from Drupal JSON:API on a local site installed with Lando. I want to use the simple_oauth module to allow registered users to edit content on ...
0
votes
1
answer
74
views
simple_oauth refresh token works only one time
I use the [simple_oauth][1] module to authenticate the user.
I have generated the first access_token using the grant_type=password.
then I have tried to get a new access_token using my refresh_token ...
0
votes
1
answer
167
views
401 error when trying to retrieve OAuth access token
I'm trying to configure simple_oauth to use with local Lando install of a Drupal 9 site with decoupled React frontend.
I followed the instructions at https://drupalize.me/tutorial/install-and-...
0
votes
1
answer
179
views
Errors when providing or generating keys for Simple OAuth module
I'm trying to configure simple_oauth to use with local Lando install of a Drupal 9 site with decoupled React frontend.
I've tried to manually generate the keys in the terminal:
$ openssl genrsa -out ...
0
votes
1
answer
76
views
Is there a way to validate access & refresh tokens issued using the Simple OAuth module?
I am using the OAuth2 authorization code grant with the Simple OAuth module. Everything is working, however I would like to be able to validate access and refresh tokens from my frontend NodeJS server....
0
votes
0
answers
68
views
user_login_finalize only works when the user has admin roles
i create custom login form in drupal 9 using user_login_finalize function. But this function only work when user has admin roles... i dont know why. This is my code :..
{
if (isset($_POST['email'])...
0
votes
0
answers
37
views
What is the preferred workflow for setting up TFA for users?
I have a D7 site in which I've setup TFA using TOTP. If TFA is not required, the user can login with their user/pwd, visit the profile page, click the security tab, and setup TFA.
However, if TFA is ...
1
vote
1
answer
299
views
Cookie authentication when reguistering users through REST API
I am running Drupal 9 commerce 2.0 as headless CMS, and I am trying to integrate the user registration/user login part of my frontend application. I was able to use the user/register REST API to ...
0
votes
1
answer
344
views
Problem with refreshing the access token
I am building an app which uses Drupal (9.4.8) as the API. I am using the Simple OAuth module to authorise the client. I have got almost everything working fine, I am receiving the Access Token and ...
0
votes
2
answers
38
views
Oauth/Saml for particular pages
I see several modules that allow oauth2/oicd/saml login to the Drupal website (my id provider allows any of the above). I am looking for different setup, I would like to configure the site so that ...
0
votes
1
answer
42
views
TFA Module not providing place to enter code, email is sent
I am having trouble getting TFA working on a new site -- Drupal 9.4.
My key's in place, I have email enabled, as well as trusted browser, etc. But when I go to login, after I enter the username and ...
1
vote
1
answer
197
views
Authentication provider for specific REST resource only
I would like to use my own auth provider for my REST services. While there's no fundamental problem with creating it, adding to my services.yml and referencing it in the .yml of the resource, it is ...
0
votes
2
answers
91
views
Authentication from a dynamically generated form
I have implemented a feature for PDF conversion using an external java program based on iText (performance is not an issue, the system is for internal usage only, users are less than a hundred, ...
-1
votes
1
answer
146
views
Trim or strip spaces around the email or username on the login page [closed]
I know that my Drupal installation (9.3.15) doesn't trim spaces at the login page (form id: user-login-form).
I have some code in the HOOK_form_user_login_form_alter but in that place in $form_state I ...
0
votes
0
answers
85
views
Best way to allow local users login while using OpenID Connect?
I'm trying to find the best way to allow local users login on a D9 installation that is setup to log the majority of users via OpenID Connect on a keycloak server which I don't handle myself.
I may ...
0
votes
0
answers
136
views
Password reset links sometimes don't work
I've got this problem where once in a while, when a user uses the one time password link, instead of going to the password reset page, it takes them to the home page. Whenever this happens, in the ...
1
vote
0
answers
42
views
How assign new simple_oauth scopes?
I've a problem with simple_oauth module and scopes, on a D 9.3.x site.
I'm using it to authenticate user in a decoupled front-end in Next.js.
The case is:
A (new) user log-in without roles expect ...
-3
votes
1
answer
120
views
How to make users stay logged in across devices? [closed]
https://api.drupal.org/api/drupal/core!modules!user!user.module/function/user_login_finalize/9.2.x regenerates the sessions each time the user logs in. This can become a little hassle if user for ...
0
votes
1
answer
198
views
Wrong user page loaded after user_login_finalize()/user_logout()
I have a third party login custom module that calls user_login_finalize() after authentication, and user_logout() upon logout. Both of these functionalities work except if the user logs in/out from ...
1
vote
0
answers
64
views
"JSON Web Authentication (JWT)" module support for 3rd party JTW issuer
Does Drupal "JSON Web Authentication (JWT)" module support authenticating JWTs generated by a 3rd party JWT Issuer (rather than by the internal module's Issuer)?
0
votes
0
answers
343
views
Drupal Webform REST
I am trying to use Drupal Webform REST.
I got an error "The 'restful post webform_rest_submit' permission is required." on browser console. I have enabled modules and REST resources as ...
1
vote
1
answer
526
views
"There have been more than 5 failed login attempts for this account. It is temporarily blocked." and the flood table is empty
When I try to log in as an admin user, I am getting the following error:
There have been more than 5 failed login attempts for this account. It
is temporarily blocked. Try again later or request a ...
0
votes
0
answers
469
views
LDAP integration not working with Drupal 9 (using Ludwig as a composer alternative - was working under Drupal 8)
I 'm having a problem since updating to Drupal 9, with regards to LDAP integration. Previously, while on Drupal 8, I had successfully integrated my schools LDAP for users authentication, using the ...
3
votes
3
answers
2k
views
AccessDeniedHttpException on a route with _access: TRUE
In my custom module I have a few "publication" routes that do not need any kind of authentication. Months ago I learnt that I could achieve this with the following requirements in routing....
0
votes
1
answer
183
views
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: '',
...
0
votes
2
answers
296
views
The sequence of actions upon cookie-authentication to Drupal site
There is a drupal 9 site that has a REST-endpoint that can be accessed for logged-in users (not for anonymous ones).
And, it's necessary to make a GET request to the endpoint using cookie ...
0
votes
0
answers
91
views
Getting 403 randomly on files
I have a react-native app that authenticates with Drupal via oAuth2 (simple_oauth, openidconnect) and do not use cookies. I use my access token for all rest calls, images and other files. Very ...
0
votes
0
answers
77
views
Unable to log in using Chrome browser
I having an issue with my Drupal site (8.9.19)
Using Firefox browser, there is no problem login for all users
However, when using Chrome - users are unable to access. This is what I received in the ...
2
votes
0
answers
45
views
Drupal access without authentication depending on the source network
Is it possible to avoid the login page depending on the user's network of origin? We have a Drupal setup that can be accessed from a VPN and from the internet. We would like to make it so that users ...
2
votes
0
answers
132
views
Should post requests revoke my access token when using Simple Oauth?
I'm using Simple Oauth (4.x) in a headless application which is working well. However, I have noticed that when doing a post request that my access token is revoked, and the next post request will ...
-1
votes
1
answer
87
views
Using Authentication API module
I'm trying to use the User Authentication API module. My goal is to add some post-processing after successful Drupal 7 login that posts JSON to an external web service. This would be work very similar ...
1
vote
0
answers
121
views
How can I allow users to change their email addresses without a password with JSON:API?
I have an Ionic React app and I want to allow users to change their email addresses.
However, when I try to change the email address in a PATCH request, I get the following error:
{
"jsonapi&...
1
vote
1
answer
371
views
How can I implement sign in with Google / Apple for a decoupled site?
I have a decoupled Drupal site that uses JSON:API to serve an Ionic React app.
I'm currently using the JWT (JSON Web Token Authentication module to enable users to register and log in (alongside the ...
0
votes
1
answer
39
views
Securing admin account, silly "solution" found
Hello fellow Drupalers,
I've been given the task of securing our admin account, on our websites (drupal 7) from outsiders.
My first thought was 2FA and I looked at some of the modules (tfa, google ...
0
votes
1
answer
2k
views
How to get current user jwt token?
In a custom module, I need to get the jwt token (access_token) related to the current user. Following this issue I've tried to get it, but without success, because get_jwt_key() and jwt_token_params() ...
0
votes
1
answer
171
views
How do I let users cancel their account with JWT / JSON:API?
I am making an Ionic app with Drupal as the backend. Users log in via JWT. I'm using JSON:API to send data to Ionic. Now I want to allow users to cancel their accounts in the app (by JSON:API) ...
0
votes
1
answer
969
views
Success with cookie, fails with JWT: RuntimeException: Failed to start the session because headers have already been sent
My Controller is working with cookie auth but failing with JWT. This Controller is supposed to flag an entity for the logged-in user.
If I am using cookie auth, there are no errors and everything ...
0
votes
1
answer
100
views
How do I allow only username for password reset form?
By default the password reset module allows 'Username OR E-mail'. I am using a module which allows multiple user accounts with a same email address (but usernames are unique and auto-generated), so ...
0
votes
1
answer
114
views
OAuth2 Server sending 'null' as the 'sub' parameter instead of User Id
When using OAuth2 Server module to authorize with users, I am not receiving the correct "sub" parameter in the response from the server. I get all the other fields such as email, ...
1
vote
0
answers
268
views
How to get a JWT token when not logged in
If I am logged in (have a session cookie) and make a GET request to /jwt/token, then I get a JWT token. How do I get the token if I am not logged in?
This article by Preston So states:
As a logged-...
-1
votes
1
answer
208
views
Query user_field_data in Drupal
I need to query the user_field_data table to see if a user exists. Through a query string, I pass to a php script that is on the server username and password in clear text. This script connects to the ...