try as below
to create external app - goto admin-> Tenant-> External Application …create one and select the scopes you need and get the app id as clietid and secret as cleint secret and scope also can be copied
the response can be used in further calls
cheers