From the course: JavaScript: Ajax and Fetch
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Work with authorization errors - JavaScript Tutorial
From the course: JavaScript: Ajax and Fetch
Work with authorization errors
- [Instructor] When errors happen in an API request, sometimes half the battle is understanding what went wrong. Often the error code and message returned from a failed request is enough to point you in the right direction. But once you have a general idea of the issue, it's also important to understand how to fix it. One common error you might encounter is an Authorization Error. Which corresponds with a 401 HTTP code. When you request results in this error, it generally has to do with your API key. A few things can go wrong with an API key. The first place to check is to ensure that the key in your code matches the credential issued by the web service. A copy and paste error or even erroneously typing or deleting a single character in the wrong place can cause issues here. If the key and your code matches the provided string, another thing to check is that you're using the correct key. Some providers such as SmartyStreets provide multiple authentication strings and it's up to you to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Structure Ajax requests for performance2m 49s
-
(Locked)
View requests and responses in the browser3m 21s
-
(Locked)
Work with authorization errors2m 56s
-
(Locked)
Work with malformed requests5m 15s
-
(Locked)
Work with errors in Fetch4m 44s
-
(Locked)
Provide error fallbacks7m 15s
-
(Locked)
Challenge: Fix an Ajax request49s
-
(Locked)
Solution: Fix an Ajax request4m 29s
-
(Locked)
-
-