[GH-ISSUE #4474] OIDC OAuth without code challenge? #9948

Closed
opened 2026-04-13 05:47:32 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rahinkore on GitHub (Sep 5, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4474

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Current vs. Expected behavior

Currently I have a system where when I go to authorize api, login and get the code to get the OIDC access token.

But I want it so I can call an api route where I give my login info(email, password) and it will return me OIDC access token

Or if thats not possible, that I can remotely login from an api route I make.

What version of Better Auth are you using?

1.3.7

System info

bunx @better-auth/cli info
Usage: better-auth [options] [command]

Better Auth CLI

Options:
  -V, --version       output the version number
  -h, --help          display help for command 

Commands:
  init [options]
  migrate [options]
  generate [options]
  secret

Which area(s) are affected? (Select all that apply)

Other

Auth config (if applicable)


Additional context

No response

Originally created by @rahinkore on GitHub (Sep 5, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4474 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce - ### Current vs. Expected behavior Currently I have a system where when I go to authorize api, login and get the code to get the OIDC access token. But I want it so I can call an api route where I give my login info(email, password) and it will return me OIDC access token Or if thats not possible, that I can remotely login from an api route I make. ### What version of Better Auth are you using? 1.3.7 ### System info ```bash bunx @better-auth/cli info Usage: better-auth [options] [command] Better Auth CLI Options: -V, --version output the version number -h, --help display help for command Commands: init [options] migrate [options] generate [options] secret ``` ### Which area(s) are affected? (Select all that apply) Other ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 05:47:32 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 5, 2025):

Better Auth does not support obtaining OIDC access tokens by directly submitting email and password to an API route (i.e., the resource owner password credentials grant is not supported). The only supported flows for token issuance are the standard OAuth2 authorization code and refresh token grants, which require a code challenge (PKCE) for public clients. Attempts to use other grant types, like "password", will result in an error. This design is intentional for security reasons and aligns with best practices for OAuth2/OIDC providers. There are no built-in endpoints or workarounds for bypassing these flows or issuing tokens directly with credentials in version 1.3.7 [source].

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3259629458 --> @dosubot[bot] commented on GitHub (Sep 5, 2025): <!-- Answer --> Better Auth does not support obtaining OIDC access tokens by directly submitting email and password to an API route (i.e., the resource owner password credentials grant is not supported). The only supported flows for token issuance are the standard OAuth2 authorization code and refresh token grants, which require a code challenge (PKCE) for public clients. Attempts to use other grant types, like "password", will result in an error. This design is intentional for security reasons and aligns with best practices for OAuth2/OIDC providers. There are no built-in endpoints or workarounds for bypassing these flows or issuing tokens directly with credentials in version 1.3.7 [[source]](https://github.com/better-auth/better-auth/blob/a39d09d3ff83b526fb9caf691d3bbcb3b7b2335b/packages/better-auth/src/plugins/oidc-provider/index.ts). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ab5af03e-5153-4cc8-b50b-c4e9c189a93e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4474)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9948