Skip to content

Authorization

Josh Shepherd edited this page Jun 24, 2021 · 2 revisions

Authorization

Spotify4Unity supports some of the authorization types available in SpotifyAPI-NET.

When you set your Authorization Type on the SpotifyService, you need to add the related Auth Config component to the same file. The config allows you to adjust the auth method with some options.

Redirect URI & Port

On every config, you can adjust the Redirect URI property and the Port used. If you change the Port, you need make sure the Redirect URI is updated with the new port.

For example, if I set the Port to 7777, then the Redirect URI should be http://localhost:7777/callback

PKCE

Requires the PKCE_AuthConfig script component next to the SpotifyService. PKCE is the recommended method as it requires single authorization from the user and can be refreshed without user input. The token can also be saved either in a file or in PlayerPrefs and loaded within the next session, without user input.

Spotify Documentation: PKCE

Implicit Grant

Requires the ImplicitGrant_AuthConfig script component next to the SpotifyService. This method contains no additional configuration

Spotify Documentation: Implicit Grant

Client Credentials

Requires the ClientCredentials_AuthConfig script component next to the SpotifyService. This method requires your client secret id

Spotify Documentation: Client Credentials

Clone this wiki locally