Skip to content

How to setup Authentik for OAuth2 Password Grant? #5860

@yceruto

Description

@yceruto

Describe your question/
We are trying to use Authentik as our own identity provider inside a Microservice architecture to login users through OAuth2 Password Grant. Basically, we want to implement this flow: https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow.

We found in the documentation that it's not listed as grant type https://goauthentik.io/docs/providers/oauth2/ but inside https://goauthentik.io/docs/providers/oauth2/client_credentials there is a note about password grant saying:

Note that authentik does treat a grant type of password the same as client_credentials to support applications 
which rely on a password grant.

Further, checking the OpenID endpoint /application/o/{appName}/.well-known/openid-configuration we see that the password grant is supported:

{
    "grant_types_supported": [
        "authorization_code",
        "refresh_token",
        "implicit",
        "client_credentials",
        "password",
        "urn:ietf:params:oauth:grant-type:device_code"
    ],
}

According to that, we've tried to send requests with many alternatives, including scope, response_type, etc, without success:

curl --request POST \
  --url 'https://{domain}/application/o/token/' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=password \
  --data 'username={username}' \
  --data 'password={password}' \
  --data 'client_id={clientId}' \
  --data 'client_secret={clientSecret}'

It always fails saying:

{
    "error": "invalid_grant",
    "error_description": "The provided authorization grant or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client"
}

We appreciate it any advice about this topic or any confirmation that the password grant is not supported. Thanks!

Version and Deployment (please complete the following information):

  • authentik version: 2023.5.3
  • Deployment: helm

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions