Using auth0 on local machine and can't make API calls

Hi. i’m using auth0 with spring boot security. i did all steps that are mentioned in this page : Auth0 Java Spring Boot SDK Quickstarts: Login
i was able to authenticate the user and create a new session. i’m trying to do API requests from Postman to my server (localhost) and i’m getting the login page as response, when i remove .anyRequest().authenticated() from the code i’m able to make the request.

how can i make the request from postman without disabling the authentication? i also tried to add the authorization cookie to the request and still no luck and it seems like it’s can only be done from the browser. we will also want to API docs on our system and allow users to make requests outside the browser with token as header/cookie.
is this possible? do we need to add another implementation for sending the token as header?

Hi @noam,

Welcome to the Auth0 Community!

First, have you taken a look at our Call Your API Using the Authorization Code Flow docs?

It describes the steps to pass your token as a header to call your API.

I have just tested this approach and could make requests to my API.

Please let me know how this goes for you.

Thank you.

thanks for your replay!.
for some reason it seems like i can’t control the redirect url. i’m always getting redirect to http://localhost:8080/login/oauth2/code/auth0. from the resume call http://localhost:8080/login/oauth2/code/auth0?code=<code>&state=<state>
how can i change it? i didn’t setup this address and i don’t have it in my server.
i want it to be redirected to /callback and i can’t find where i should define it. this is how the redirect flow looks like:

Hi @noam,

Thank you for your response.

It appears that you have not configured the Allowed Callback URLs in your Auth0 Dashboard application settings. For example, in the Auth0 Java Spring Boot SDK Quickstarts: Login doc, the /login/oauth2/code/auth0 is the expected URI for the callback URL.

On the other hand, if you prefer to redirect to another URL, it may be possible to change this value by specifying the redirect_uri parameter in your application.yml file.

Please let me know how this works.