Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda