Closed JulianSauer closed 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)
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
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?
That is called URL encoding and is actually necessary in order to put a URL inside the query string of another URL.
Yup, thought that was the source of my bug but I guess I was wrong. Thank you!
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?