Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DmitrySikorsky/b5235980b54aa5532dde1c596569657a to your computer and use it in GitHub Desktop.
Save DmitrySikorsky/b5235980b54aa5532dde1c596569657a to your computer and use it in GitHub Desktop.
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