{"meta":{"title":"Troubleshooting OAuth app access token request errors","intro":"When exchanging a code for an access token, there are an additional set of errors that can occur. The format of these responses is determined by the accept header you pass.","product":"Apps","breadcrumbs":[{"href":"/en/apps","title":"Apps"},{"href":"/en/apps/oauth-apps","title":"OAuth apps"},{"href":"/en/apps/oauth-apps/maintaining-oauth-apps","title":"Maintaining OAuth apps"},{"href":"/en/apps/oauth-apps/maintaining-oauth-apps/troubleshooting-oauth-app-access-token-request-errors","title":"Troubleshoot token request"}],"documentType":"article"},"body":"# Troubleshooting OAuth app access token request errors\n\nWhen exchanging a code for an access token, there are an additional set of errors that can occur. The format of these responses is determined by the accept header you pass.\n\n> \\[!NOTE]\n> These examples only show JSON responses.\n\n## Incorrect client credentials\n\nIf the client\\_id and or client\\_secret you pass are incorrect you will\nreceive this error response.\n\n```json\n{\n  \"error\": \"incorrect_client_credentials\",\n  \"error_description\": \"The client_id and/or client_secret passed are incorrect.\",\n  \"error_uri\": \"/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials\"\n}\n```\n\nTo solve this error, make sure you have the correct credentials for your OAuth app. Double check the `client_id` and `client_secret` to make sure they are correct and being passed correctly\nto GitHub.\n\n## Redirect URI mismatch\n\nIf you provide a `redirect_uri` that doesn't match what you've registered with your OAuth app, you'll receive this error message:\n\n```json\n{\n  \"error\": \"redirect_uri_mismatch\",\n  \"error_description\": \"The redirect_uri MUST match the registered callback URL for this application.\",\n  \"error_uri\": \"/apps/managing-oauth-apps/troubleshooting-authorization-request-errors/#redirect-uri-mismatch2\"\n}\n```\n\nTo correct this error, either provide a `redirect_uri` that matches what\nyou registered or leave out this parameter to use the default one\nregistered with your application.\n\n## Bad verification code\n\nIf the verification code you pass is incorrect, expired, or doesn't\nmatch what you received in the first request for authorization you will\nreceive this error.\n\n```json\n{\n  \"error\": \"bad_verification_code\",\n  \"error_description\": \"The code passed is incorrect or expired.\",\n  \"error_uri\": \"/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#bad-verification-code\"\n}\n```\n\nTo solve this error, start the [OAuth authorization process again](/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps)\nand get a new code.\n\n## Unverified user email\n\nIf the user for whom you are trying to generate a user access token has not verified their primary email address with GitHub, you will receive this error.\n\n```json\n{\n  \"error\": \"unverified_user_email\",\n  \"error_description\": \"The user must have a verified primary email.\",\n  \"error_uri\": \"/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#unverified_user_email\"\n}\n```\n\nTo resolve this error, prompt the user to verify the primary email address on their GitHub account. For more information, see [Verifying your email address](/en/account-and-profile/how-tos/email-preferences/verifying-your-email-address)."}