Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Web API PKCE Authorize Not Working: INVALID_CLIENT: Invalid redirect URI

Web API PKCE Authorize Not Working: INVALID_CLIENT: Invalid redirect URI

Plan

Premium

Country

USA

Device

Pixel 3a Emulator

Operating System

Android 13

 

My Question or Issue

I am developing a mobile app with flutter/dart that uses Spotify's Web API. I am able to authenticate users without PKCE but when I use PKCE I get the error "INVALID_CLIENT: Invalid redirect URI" yet I have not changed the redirect URI and the URI used in the request matches the URI in the settings in my developer portal. Do I need to do anything other than use the parameters code_challenge_method and code_challenege to use PKCE?

 

Here is an example of the authorization URl I use:

https://accounts.spotify.com/authorize?response_type=code&client_id=[My Client ID]&scope=user-top-re...

Query Parameters:

response_type: code

client_id: [My Client ID]

scope: user-top-read+user-read-recently-played

redirect_uri: com.example.abc-spotify%3A%2F%2F

state: kDHp9NZjWbYD

code_challenge_method: S256

code_challenge: 877811825597e44c2a3f38f2ea615370212d32a3837c1e98bec67f1b103be88b

 

This was the code verifier in this example: ueA7xfrl9hB8Q8jPBzvxHL0ldxzjPN5PWCGnG8pbtw7Gmlin9nyBXw2l4hFc6rDQflcUmAbbe72bURkY5QAfErDsKjDZ1x3P9glG

Reply
1 Reply

I know this is old, but were you ever able to get it figured out? I am having the same issue with a react native project.

Suggested posts