I created a spa
application owned by my organization only, but there was a problem when I requested code. How can I resolve it?
I can reproduce your problem, you have to add the redirect URL under the web (not single page application). After that, you will be able to use the auth code flow to get the code.