I want to know how i get the access token

the URL you redirect to is to a server you control and where your code runs.

Only you know what your redirect will be