microsoft-authentication-library-for-go icon indicating copy to clipboard operation
microsoft-authentication-library-for-go copied to clipboard

[Feature Request] CreateAuthCodeURL - adding state & challenge

Open samueldominguez opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. When using CreateAuthCodeURL I can't set a challenge or state, so I have to manually add it to the URL.

Describe the solution you'd like Allow CreateAuthCodeURL to use a challenge, and set a custom state. You would get the code verifier back, to set it when you get a token from the auth code.

Describe alternatives you've considered Manipulating the URL after it has been generated by CreateAuthCodeURL but the functionality to generate the code verifier and so on is already present in the package so why not do this automatically?

Additional context N/A.

samueldominguez avatar Jun 19 '21 22:06 samueldominguez

As I see such library not supported by Microsoft? Why then recommend to use MSAL only then in docs?

simonoff avatar Jun 07 '22 10:06 simonoff

It has been a year and a half since this issue was being created. I have the same request for allowing custom session_state and code_challenge.

  • Session State: In the current implementation, we can only get a random session_state from AAD. Allowing custom state in GenerateAuthCodeURL() provides feature parity to other MSAL libraries such as MSAL.js.

  • Code Challenge: If I understand correctly, MSAL for Golang does support PKCE when using the AcquireTokenBy...() methods, which completes the second half of the workflow. But there is no documentation/example/support on the first half.

    • Using CodeLogin as an example, the challenge must be set when generating the auth code URL, then being verified in AcquireTokenByAuthCode(). The first part is missing in this library.

These should be essential for something to be used in production.

zc07 avatar Feb 24 '23 20:02 zc07