Problem to create api with Ueberauth

Im creating a libe for Oauth2 and handel register user and managment. in this libe I used Ueberauth to handle login with Social Networks.
But I have a big problem with it, when I created api for my Lib that will be open source.I realized I cant handle redirect link after getting back to my site.
To be clear, I have 2 router and some Strategy in my Library.
the Html render and create session. in this way i have no problem because my user select on Button and goes to provider site like github and gets back to my call back url, but please consider, you have some api in your site which the mobile application should request your site and redirect to github with WebView and gets back, then gets the Temporary github code on home page or the page is not Ueberauth call back router, and then send the code to call back.
but it is impossible, because we should disable redirect link in config file and read the github config on it’s file and redirect to home page for example.

here our first way which is html is broken. because after user requests to our router and gets back, he is redirected to main page ro home page nor our call back router.

I have read these posts:

Since we can’t add multi configs for this Lib like 2 github client_id and client_secret and custom redirect links for each Strategies

what way you could suggest me?

Thanks