Created
December 23, 2022 20:37
-
-
Save DmitrySikorsky/b5235980b54aa5532dde1c596569657a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
[HttpGet] | |
public ActionResult Index(string platform, string provider, string token) | |
{ | |
string url; | |
if (provider == "apple") | |
url = "https://appleid.apple.com/auth/authorize" + | |
"?client_id=com.your.app" + | |
"&redirect_uri=https://auth.yourapp.com/callback" + | |
"&response_type=code%20id_token" + | |
"&response_mode=form_post" + | |
"&scope=email" + | |
"&state=" + (platform ?? "unknown") + ';' + token; | |
else if (provider == "google") | |
url = "https://accounts.google.com/o/oauth2/auth" + | |
"?client_id=XXXXXXXXXX.apps.googleusercontent.com" + | |
"&redirect_uri=https://auth.yourapp.com/callback" + | |
"&response_type=id_token" + | |
"&response_mode=form_post" + | |
"&scope=email" + | |
"&state=" + (platform ?? "unknown" ) + ';' + token; | |
else return this.BadRequest(); | |
return this.Redirect(url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment