Skip to content

Commit ae55ddb

Browse files
committed
Replace port 5000 (often used) with 5543, fixes JohnnyCrazy#868
1 parent dfcd8a1 commit ae55ddb

13 files changed

Lines changed: 77 additions & 66 deletions

File tree

‎SpotifyAPI.Docs/docs/5_to_6.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private static async void AuthOnAuthReceived(object sender, AuthorizationCode pa
132132

133133
// NEW
134134
var config = SpotifyClientConfig.CreateDefault();
135-
var server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000);
135+
var server = new EmbedIOAuthServer(new Uri("http://localhost:5543/callback"), 5543);
136136
server.AuthorizationCodeReceived += async (sender, response) =>
137137
{
138138
await server.Stop();

‎SpotifyAPI.Docs/docs/authorization_code.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ title: Authorization Code
1010
If you are already in control of a Web-Server (like `ASP.NET`), you can start the flow by generating a login uri:
1111

1212
```csharp
13-
// Make sure "http://localhost:5000" is in your applications redirect URIs!
13+
// Make sure "http://localhost:5543" is in your applications redirect URIs!
1414
var loginRequest = new LoginRequest(
15-
new Uri("http://localhost:5000"),
15+
new Uri("http://localhost:5543"),
1616
"ClientId",
1717
LoginRequest.ResponseType.Code
1818
)
@@ -23,14 +23,14 @@ var uri = loginRequest.ToUri();
2323
// Redirect user to uri via your favorite web-server
2424
```
2525

26-
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5000` and a `code` parameter is attached to the query. This `code` has to be exchanged for an `access_token` and `refresh_token`:
26+
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5543` and a `code` parameter is attached to the query. This `code` has to be exchanged for an `access_token` and `refresh_token`:
2727

2828
```csharp
29-
// This method should be called from your web-server when the user visits "http://localhost:5000"
29+
// This method should be called from your web-server when the user visits "http://localhost:5543"
3030
public Task GetCallback(string code)
3131
{
3232
var response = await new OAuthClient().RequestToken(
33-
new AuthorizationCodeTokenRequest("ClientId", "ClientSecret", code, "http://localhost:5000")
33+
new AuthorizationCodeTokenRequest("ClientId", "ClientSecret", code, "http://localhost:5543")
3434
);
3535

3636
var spotify = new SpotifyClient(response.AccessToken);
@@ -52,7 +52,7 @@ You can also let the `AuthorizationCodeAuthenticator` take care of the refresh p
5252

5353
```csharp
5454
var response = await new OAuthClient().RequestToken(
55-
new AuthorizationCodeTokenRequest("ClientId", "ClientSecret", code, "http://localhost:5000")
55+
new AuthorizationCodeTokenRequest("ClientId", "ClientSecret", code, "http://localhost:5543")
5656
);
5757
var config = SpotifyClientConfig
5858
.CreateDefault()
@@ -76,8 +76,8 @@ private static EmbedIOAuthServer _server;
7676

7777
public static async Task Main()
7878
{
79-
// Make sure "http://localhost:5000/callback" is in your spotify application as redirect uri!
80-
_server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000);
79+
// Make sure "http://localhost:5543/callback" is in your spotify application as redirect uri!
80+
_server = new EmbedIOAuthServer(new Uri("http://localhost:5543/callback"), 5543);
8181
await _server.Start();
8282

8383
_server.AuthorizationCodeReceived += OnAuthorizationCodeReceived;
@@ -97,7 +97,7 @@ private static async Task OnAuthorizationCodeReceived(object sender, Authorizati
9797
var config = SpotifyClientConfig.CreateDefault();
9898
var tokenResponse = await new OAuthClient(config).RequestToken(
9999
new AuthorizationCodeTokenRequest(
100-
"ClientId", "ClientSecret", response.Code, new Uri("http://localhost:5000/callback")
100+
"ClientId", "ClientSecret", response.Code, new Uri("http://localhost:5543/callback")
101101
)
102102
);
103103

‎SpotifyAPI.Docs/docs/example_asp.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This example is based on ASP .NET Core. It uses `Authorization Code` under the h
1717

1818
## Run it
1919

20-
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5001` is a redirect uri of it.
20+
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5543` is a redirect uri of it.
2121

2222
```bash
2323
# Assumes linux and current working directory is the cloned repository
@@ -26,5 +26,5 @@ dotnet restore
2626

2727
SPOTIFY_CLIENT_ID=YourClientId SPOTIFY_CLIENT_SECRET=YourClientSecret dotnet run
2828

29-
# Visit https://localhost:5001
29+
# Visit https://localhost:5543
3030
```

‎SpotifyAPI.Docs/docs/example_blazor.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Very similar to the [Blazor WASM Example](example_blazor_wasm.md), but runs code
1313

1414
## Run it
1515

16-
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5001` is a redirect uri of it.
16+
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5543` is a redirect uri of it.
1717

1818
```bash
1919
# Assumes linux and current working directory is the cloned repository
@@ -22,5 +22,5 @@ dotnet restore
2222

2323
SPOTIFY_CLIENT_ID=YourClientId SPOTIFY_CLIENT_SECRET=YourClientSecret dotnet run
2424

25-
# Visit https://localhost:5001
25+
# Visit https://localhost:5543
2626
```

‎SpotifyAPI.Docs/docs/example_blazor_wasm.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Since this library is compatible with `.NET Standard 2.1`, you can use all featu
1616

1717
## Run it
1818

19-
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5001` is a redirect uri of it.
19+
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5543` is a redirect uri of it.
2020

2121
```bash
2222
# Assumes linux and current working directory is the cloned repository
@@ -26,5 +26,5 @@ dotnet restore
2626
echo "{ \"SPOTIFY_CLIENT_ID\": \"YourSpotifyClientId\" }" > wwwroot/appsettings.json
2727
dotnet run
2828

29-
# Visit https://localhost:5001
29+
# Visit https://localhost:5543
3030
```

‎SpotifyAPI.Docs/docs/example_cli_custom_html.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ An example to show how you can display your own HTML resource after the user wen
1313

1414
## Run it
1515

16-
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5001` is a redirect uri of it.
16+
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5543` is a redirect uri of it.
1717

1818
```bash
1919
# Assumes linux and current working directory is the cloned repository

‎SpotifyAPI.Docs/docs/example_cli_persistent_config.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The access and refresh token is saved in a `credentials.json` file of the curren
1111

1212
## Run it
1313

14-
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5000` is a redirect uri of it.
14+
Before running it, make sure you created an app in your [spotify dashboard](https://developer.spotify.com/dashboard/) and `https://localhost:5543` is a redirect uri of it.
1515

1616
```bash
1717
# Assumes linux and current working directory is the cloned repository

‎SpotifyAPI.Docs/docs/implicit_grant.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ This flow is useful for getting a user access token for a short timespan.
1414
If you are already in control of a Web-Server (like `ASP.NET`), you can start the flow by generating a login uri:
1515

1616
```csharp
17-
// Make sure "http://localhost:5000" is in your applications redirect URIs!
17+
// Make sure "http://localhost:5543" is in your applications redirect URIs!
1818
var loginRequest = new LoginRequest(
19-
new Uri("http://localhost:5000"),
19+
new Uri("http://localhost:5543"),
2020
"ClientId",
2121
LoginRequest.ResponseType.Token
2222
)
@@ -27,7 +27,7 @@ var uri = loginRequest.ToUri();
2727
// Redirect user to uri via your favorite web-server
2828
```
2929

30-
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5000` and the fragment identifier (`#` part of URI) will contain an access token.
30+
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5543` and the fragment identifier (`#` part of URI) will contain an access token.
3131

3232
:::warning
3333
Note, this parameter is not sent to the server! You need JavaScript to access it.
@@ -77,15 +77,15 @@ For a real example, have a look at the [Example.UWP](https://github.com/JohnnyCr
7777

7878
# Using Spotify.Web.Auth
7979

80-
For cross-platform CLI and desktop apps (non `UWP` apps), custom protocol handlers are sometimes not an option. The fallback here is a small cross-platform embedded web server running on `http://localhost:5000` serving JavaScript. The JavaScript will parse the fragment part of the URI and sends a request to the web server in the background. The web server then notifies your appliciation via an event.
80+
For cross-platform CLI and desktop apps (non `UWP` apps), custom protocol handlers are sometimes not an option. The fallback here is a small cross-platform embedded web server running on `http://localhost:5543` serving JavaScript. The JavaScript will parse the fragment part of the URI and sends a request to the web server in the background. The web server then notifies your appliciation via an event.
8181

8282
```csharp
8383
private static EmbedIOAuthServer _server;
8484

8585
public static async Task Main()
8686
{
87-
// Make sure "http://localhost:5000/callback" is in your spotify application as redirect uri!
88-
_server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000);
87+
// Make sure "http://localhost:5543/callback" is in your spotify application as redirect uri!
88+
_server = new EmbedIOAuthServer(new Uri("http://localhost:5543/callback"), 5543);
8989
await _server.Start();
9090

9191
_server.ImplictGrantReceived += OnImplicitGrantReceived;

‎SpotifyAPI.Docs/docs/pkce.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ var (verifier, challenge) = PKCEUtil.GenerateCodes("YourSecureRandomString");
2525
Like most auth flows, you'll need to redirect your user to Spotify's servers so they are able to grant access to your application:
2626

2727
```csharp
28-
// Make sure "http://localhost:5000/callback" is in your applications redirect URIs!
28+
// Make sure "http://localhost:5543/callback" is in your applications redirect URIs!
2929
var loginRequest = new LoginRequest(
30-
new Uri("http://localhost:5000/callback"),
30+
new Uri("http://localhost:5543/callback"),
3131
"YourClientId",
3232
LoginRequest.ResponseType.Code
3333
)
@@ -40,15 +40,15 @@ var uri = loginRequest.ToUri();
4040
// Redirect user to uri via your favorite web-server or open a local browser window
4141
```
4242

43-
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5000/callback` and a `code` parameter is attached to the query. The redirect URI can also contain a custom protocol paired with UWP App Custom Protocol handler. This received `code` has to be exchanged for an `access_token` and `refresh_token`:
43+
When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to `http://localhost:5543/callback` and a `code` parameter is attached to the query. The redirect URI can also contain a custom protocol paired with UWP App Custom Protocol handler. This received `code` has to be exchanged for an `access_token` and `refresh_token`:
4444

4545
```csharp
46-
// This method should be called from your web-server when the user visits "http://localhost:5000/callback"
46+
// This method should be called from your web-server when the user visits "http://localhost:5543/callback"
4747
public Task GetCallback(string code)
4848
{
4949
// Note that we use the verifier calculated above!
5050
var initialResponse = await new OAuthClient().RequestToken(
51-
new PKCETokenRequest("ClientId", code, "http://localhost:5000", verifier)
51+
new PKCETokenRequest("ClientId", code, "http://localhost:5543", verifier)
5252
);
5353

5454
var spotify = new SpotifyClient(initialResponse.AccessToken);

‎SpotifyAPI.Web.Examples/Example.CLI.CustomHTML/Program.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public static async Task Main()
2424
}
2525

2626
_server = new EmbedIOAuthServer(
27-
new Uri("http://localhost:5000/callback"),
28-
5000,
27+
new Uri("http://localhost:5543/callback"),
28+
5543,
2929
Assembly.GetExecutingAssembly(),
3030
"Example.CLI.CustomHTML.Resources.custom_site"
3131
);
@@ -38,7 +38,7 @@ public static async Task Main()
3838
Scope = new List<string> { UserReadEmail }
3939
};
4040

41-
Uri uri = request.ToUri();
41+
var uri = request.ToUri();
4242
try
4343
{
4444
BrowserUtil.Open(uri);
@@ -48,14 +48,14 @@ public static async Task Main()
4848
Console.WriteLine("Unable to open URL, manually open: {0}", uri);
4949
}
5050

51-
Console.ReadKey();
51+
_ = Console.ReadKey();
5252
}
5353

5454
private static async Task OnAuthorizationCodeReceived(object sender, AuthorizationCodeResponse response)
5555
{
5656
await _server.Stop();
5757

58-
AuthorizationCodeTokenResponse token = await new OAuthClient().RequestToken(
58+
var token = await new OAuthClient().RequestToken(
5959
new AuthorizationCodeTokenRequest(clientId, clientSecret, response.Code, _server.BaseUri)
6060
);
6161

0 commit comments

Comments
 (0)