zmb3 / spotify

A Go wrapper for the Spotify Web API
Apache License 2.0
1.37k stars 287 forks source link

Ascii codes in authentication Uri #65

Closed JulianSauer closed 6 years ago

JulianSauer commented 6 years ago

Hey,

I've tried using this wrapper for authentication. It seems to work fine except for the redirectURL and state which contain a hexadecimal representation of their special characters:

auth = spotify.NewAuthenticator("http://localhost:4200/create", spotify.ScopeUserModifyPlaybackState) config := config.ReadConfig() auth.SetAuthInfo(config.ClientId, config.ClientSecret) code := rest_objects.AuthorizationCode{Uri: auth.AuthURL(time.Now().Format(time.RFC3339))} println(code.Uri)

Which prints: https://accounts.spotify...redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fcreate&...&state=2018-04-30T14%3A04%3A39%2B02%3A00

I am currently replacing these substrings but is there a way to bypass this in the first place?

zmb3 commented 6 years ago

That is called URL encoding and is actually necessary in order to put a URL inside the query string of another URL.

JulianSauer commented 6 years ago

Yup, thought that was the source of my bug but I guess I was wrong. Thank you!