- Home /
Looking at the URL String of your Default Browser
Hello Unity friends,
I have an application which loads up a web page using Application.LoadURL("url"). I'm using this to redirect my users to a login page for an external site that uses the OAuth2 workflow (Canvas LMS). This web page then has them login and then redirects them to another part of the web page which displays a secret code in the URL. This code is required by my program to complete the authorization and allow access to their site and that user's info. The problem here is that the users have to actually copy and paste that code from the browser's URL field into a text field in my game (the web page I'm using decided it was a good idea to do that instead of, I don't know, displaying it on the actual page itself). This is obviously not the most ideal way to have my users login. Is there any way for my Unity application to read the URL of the currently open browser as a string? If so I can automatically grab that code for them and save a ton of trouble.
P.S. For those of you familiar with OAuth, you might know that I could solve this problem by creating a server to host a web page of my own and then set the redirect_uri to that page instead of the default one for native applications. I can't do this, however, because my application is totally offline and I'd end up paying server upkeep costs literally just to get a code and send it to my application.