After signing in to Twitter, the application needs an access token to access the user’s Twitter profile and log the user in.
- [Instructor] 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 getOAuthAccessToken method…and pass a 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 direct.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 the router can handle it.…The reason we have a callback here rather than a rest.send…
This Node.js course gives you an overview of a RESTful API and the logical steps of creating one. It explores three different APIs, focusing on their similarities and differences and how to effectively implement one. Instructor 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. Learn how to develop Twitter Notes, a sample web application that lets users leave notes for their Twitter friends. Use Twitter's API to implement a login flow and then design a web API. Additionally, get a closer look at several other real-world APIs, and 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
- Testing user-perceived performance
- Looking at APIs in the real world
- Best practices for building RESTful APIs