Getting Blank Page While Trying to Connect Square OAuth (Sandbox)

I’m implementing Square OAuth flow in my .NET MVC application using the sandbox environment. However, when I try to connect, I get redirected to a blank page instead of the Square authorization screen.

Here’s the code I’m using to generate the OAuth URL and redirect:

private const string ClientId = “sandbox-sq0idb-2fOIpoGtJ2dv7s0eyvV0AQ”;
private const string ClientSecret = “sandbox-sq0csb-_oWmr1PoIO8x_dQL10-_cn-kTmySHiWOtf1icERlcF8”;
private const string RedirectUri = “http://localhost:5237/Square/Callback”;

var state = Guid.NewGuid().ToString();

var url = $“https://connect.squareupsandbox.com/oauth2/authorize?” +
$“client_id={ClientId}” +
$“&scope=MERCHANT_PROFILE_READ%20PAYMENTS_READ” +
$“&session=false” +
$“&state={state}” +
$“&redirect_uri={Uri.EscapeDataString(RedirectUri)}”;

return Redirect(url);

any one please tell me whats wrong with this code

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

https://developer.squareup.com/docs/oauth-api/walkthrough2

Additional Documentation

OAuth Walkthrough: Test Authorization with Web Server
Square .NET SDK Quickstart
Create the Redirect URL and Square Authorization Page URL

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Is the sandbox Seller Dashboard open in another tab when testing the OAuth flow in sandbox? It’s a requirement in sandbox. :slight_smile: