After the user signed in to Twitter and authorized our application, the application now needs to get an access token to access the user’s Twitter profile and log the user in.
- [Presenter] In the previous video we learned…how to make an OAuth request and get a temporary credential.…In this video, we are going to take a look at…exchanging the OAuth verifier or temporary…credential for an access token.…Then, we will use the access token…to get the user's information.…Finally, we will log the user into our application.…To get the access token, we only need to modify the…authenticate function in authenticator.js.…Using the OAuth module, all we need to do to…get the access token is called the get OAuth…access token method, and press request…token, request token secret, and OAuth verifier.…
We can get the request token and secret…from the cookies that we set earlier.…Twitter includes the OAuth verifier in the query parameters.…In express, we access it using req.query.oauth_verifier.…The access token and its secret will be…passed in the next callback.…If an error occurred in the request, we pass the…error to the callback, so that their alter can handle it.…The reason we have a callback here rather than…
This Node.js training course gives you an overview of a RESTful API and the logical steps of building one. It explores three different APIs, focusing on their similarities and differences to effectively implement one. Author Saleh Hamadeh starts off by defining APIs, showing how they can be built on top of HTTP and listing the properties that make an API RESTful. Then learn how to develop Twitter Notes, a sample web application that lets its users leave notes for their Twitter friends. You'll use Twitter's API to implement a login flow and then design a web API. In addition, you'll get a closer look at two other real-world APIs—Facebook API and GitHub API. Finally, learn some best practices to keep APIs secure, maintainable, and efficient.
- Identifying REST resources
- Setting up the development environment
- Consuming a RESTful API
- Creating an OAuth login request
- Getting an access token
- Saving data in MongoDB
- Building a RESTful API
- Looking at APIs in the real world
- Best practices for building RESTful APIs