Closed edwingromero closed 9 months ago
Hi @edwingromero,
I would hesitate to call this an LdapRecord-Laravel issue. Is there a stack trace of this error in your application logs that you can post?
[2021-06-01 21:15:10] local.INFO: LDAP (ldaps://192.168.30.100:636) - Operation: Binding - Username: **@??.local
[2021-06-01 21:15:11] local.INFO: LDAP (ldaps://192.168.30.100:636) - Operation: Bound - Username: @.local
[2021-06-01 21:15:11] local.INFO: LDAP (ldaps://192.168.30.100:636) - Operation: Search - Base DN: - Filter: (&(objectclass=top)(objectclass=person)(objectclass=organizationalperson)(objectclass=user)(email=eromero)(!(objectclass=computer))) - Selected: (objectguid,) - Time Elapsed: 135.64
[2021-06-01 21:15:11] local.ERROR: The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. {"exception":"[object] (Laravel\Passport\Exceptions\OAuthServerException(code: 10): The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. at C:\laragon\www\passport\vendor\laravel\passport\src\Http\Controllers\HandlesOAuthErrors.php:26)
[stacktrace]
[previous exception] [object] (League\OAuth2\Server\Exception\OAuthServerException(code: 10): The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. at C:\laragon\www\passport\vendor\league\oauth2-server\src\Exception\OAuthServerException.php:263) [stacktrace]
"}
It looks like Passport is attempting to query for a user in your LDAP server from your ldap
authentication guard with the email filter (email=eromero)
-- which is incorrect. I'm assuming you're using usernames instead of email addresses?
That's right, I use samaccountname. For Personal Access Token I use the following.
But for Password Grant Tokens I send the parameters to "/oauth/token" which is a route that passport creates by default. Add the following method in the User model to change the email to samaccountname
Add the following method in the User model to change the email to samaccountname
Are you certain this findForPassport()
method is being called? If you dd()
inside of there, does your application dump-and-die?
With or without the method I get the same error.
Add dd() inside the findForPassport method and nothing happens. It is as if he did not take it into account. Is rare
Add the following method in the User model to change the email to samaccountname
Are you certain this
findForPassport()
method is being called? If youdd()
inside of there, does your application dump-and-die?
Detect dd () in findForPassport when I use the provider "user".
When I use the provider "ldap" it does not detect it and the usual error appears.
You're going to have to help me out a bit here -- I'll either need you to create and post a link to a GitHub repository with the exact steps to recreate this issue, or dive deep into Laravel Passport and see what the issue may be and then let me know if it's a bug I have to fix 👍
You're going to have to help me out a bit here -- I'll either need you to create and post a link to a GitHub repository with the exact steps to recreate this issue, or dive deep into Laravel Passport and see what the issue may be and then let me know if it's a bug I have to fix 👍
Ok
You're going to have to help me out a bit here -- I'll either need you to create and post a link to a GitHub repository with the exact steps to recreate this issue, or dive deep into Laravel Passport and see what the issue may be and then let me know if it's a bug I have to fix 👍
Ok
Hello, sorry for the delay. This is the repository. You just have to put the ldap variables in the .env file
How about guys? I am trying to use passport and ldap in a project. Everything works perfect with "Personal Access Token". But when I try to create "Password Grant Tokens" I get the following error.