Normally you have to give the return URL in your call to the signin-page of the oauth-provider. And you have to configure your app with the provider.
Mostly oauth-providers have an example pages for developers, for example https://developer.box.com/guides/authentication/oauth2/oauth2-setup