Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Snapchat OAuth: invalid code_verifier

I'm running a vanilla OAuth flow with PKCE to get a user access token from Snapchat. The initial request is straightforward. I generate a PKCE pair in my Python backend using:

pkce_code_verifier = secrets.token_urlsafe(96)
hashed = hashlib.sha256(pkce_code_verifier.encode("ascii")).digest()
pkce_code_challenge = base64.urlsafe_b64encode(hashed).decode("ascii")[:-1]
return pkce_code_challenge, pkce_code_verifier

I pass the code challenge into my first request which successfully returns a code.

However, no matter how I structure the follow-on request to exchange the code for an access token, I receive:

{
  "error": "invalid_grant",
  "error_description": "Invalid code_verifier.",
  "state": ""
}

Here's an example CURL:

curl -X POST https://accounts.snapchat.com/accounts/oauth2/token
--header 'Authorization: Basic [redacted]'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=authorization_code'
--data-urlencode 'code=XCd9mUHo9s4osXBvEnmERloR2DjUxR_AA4el_azXnhg'
--data-urlencode 'code_verifier=kJ31ekNSvahWwczcea-q9rFI8Grl9-jDOTuXPTDIxfhuf1IEWdRbJAKf4vTeA8vxhzUHBBM9QDcn3NmEqqAlrpz8_PNP573sljIKQIur-lV-BjuWtSHMZb7zby5WpRw6'
--data-urlencode 'redirect_uri=[redacted]'

Has anyone gotten this to work? I've verified my code challenge and code verifier using a few of the online PKCE tools; they seem valid.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Turns out, it was an issue in expo-auth-session. I've documented it here: https://forums.expo.dev/t/expo-authsession-pkce-always-leads-to-invalid-code-verifier/63750.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!