invalid_code
HTTP status: 401 · Code: invalid_code
The email code is wrong, expired, or used up; ask for a new one after 5 wrong tries.
Why it happens
Section titled “Why it happens”The email code is wrong, expired, or used up. After 5 wrong tries the code stops working.
How to fix
Section titled “How to fix”Let the person type the code again. After 5 wrong tries, or if it expired, ask them to request a new code. See Email codes.
Catch it in your code
Section titled “Catch it in your code”Every SDK throws one error type for a failed call. Match on its code, which is always invalid_code for this error, never on the message.
import { ErrorCode, OrvanoError } from '@orvano/js'
try { // your Orvano call} catch (error) { if (error instanceof OrvanoError && error.code === ErrorCode.invalidCode) { // handle invalid_code } else { throw error }}import 'package:orvano_flutter/orvano_flutter.dart'; // or orvano_dart on a server
try { // your Orvano call} on OrvanoException catch (error) { if (error.code != ErrorCode.invalidCode) rethrow; // handle invalid_code}using Orvano;
try{ // your Orvano call}catch (OrvanoException error) when (error.Code == ErrorCode.InvalidCode){ // handle invalid_code}The error also carries the HTTP status (401), a message, and a request ID. Quote the request ID when you report a problem: the server logs it with the failure. See Errors for how errors work in every SDK, or every error code.