I am trying to get access token using password grant type with curl command:
curl --request POST
–url https://dev.okta.com/oauth2/v1/token
–header ‘accept: application/json’
–header ‘authorization: Basic …’
–header ‘content-type: application/x-www-form-urlencoded’
–data ‘grant_type=password&username=<>&password=<>&client_id=<>’
Running this i get below error:
{“errorCode”:“invalid_client”,“errorSummary”:“Invalid value for ‘client_id’ parameter.”,“errorLink”:“invalid_client”,“errorId”:“oaezpHU5UrjQ0CiT5uGPpfqeg”,“errorCauses”:}
Also do i need custom authorization server for this or org level authorization server works?
@khandelw You actually do not need a custom authorization server to use resource owner password flow, but what @vijet said about the use case for the built-in org authorization server does still apply.
Secondly, how the client authentication is passed depends on the configuration for your Native app in Okta. If your application has a client secret generated for it, the sample curl @vijet supplied will work, where the authorization header is the Base64 encoded clientId:clientSecret.
However, if your application is configured for PKCE, a client secret will not exist and you will not be using an authorization header. Instead, you will pass in the client_id in the body of your request, as in this example: