When authenticating a user for a WorkOS Connect application, this is the endpoint they should be redirected to. If they’re not already logged in, the user will be redirected to the AuthKit login page. For a third-party application, AuthKit prompts the user to authorize access to the application the first time they use it, and again if the application requests new scopes or organization access. Existing consent skips the consent screen when requested scopes are the same as, or a subset of, scopes previously granted.
| curl https://authkit_domain/oauth2/authorize -G \ | |
| -d "client_id=client_01JP8BD0CZ401TDF9X54NT5ZEK" \ | |
| -d "nonce=4QWsQj7bUUkCXnoC" \ | |
| --data-urlencode "redirect_uri=https://app.example.com/callback" \ | |
| -d "response_type=code" \ | |
| --data-urlencode "scope=openid profile email offline_access" \ | |
| -d "state=GPc459ttUQhB9oPn" |
| https://authkit_domain?authkit_authorization_session_id=01JPXGD1R10QHJZHPGYS3DT952&redirect_uri=&https%3A%2F%2Fapp.example.com%2Fcallback&state=GPc459ttUQhB9oPn |
GET/oauth2 /authorize
Parameters
Returns
When the flow completes, AuthKit redirects the user back to the redirect_uri with a code and the state from the request in the query string. If the request fails after the redirect_uri has been validated, AuthKit instead redirects with error, an optional error_description, and state.
Both responses also include an iss parameter containing your AuthKit domain, as per RFC 9207. Clients that talk to multiple authorization servers should check that iss matches the issuer from the metadata before exchanging the code, to prevent mix-up attacks. Support is advertised as authorization_response_iss_parameter_supported in the metadata.