Greetings! We invite you to complete a test task that will help us assess your TypeScript knowledge and skills in developing REST APIs. Your task is to create a server that provides OAuth 2.0 authorization. This is an excellent opportunity to get familiar with or strengthen your knowledge of OAuth 2.0, which is an essential aspect for any backend developer.
In this task, you will implement two REST API endpoints, entirely in TypeScript. The project should be easy to run and must adhere to the OAuth 2.0 specification. This task will not only test your skills but also allow you to dive into the OAuth 2.0 specification.
http://localhost:8080/api/oauth/authorizeGETresponse_type=code parameter. Upon successful authorization, the user should be redirected to the specified redirect_uri with an appended code parameter, which will be used to obtain an access token. Implementing support for the state parameter is optional but would be considered a plus. This parameter helps protect applications from CSRF attacks and maintains state between requests and responses.http://localhost:8080/api/oauth/tokenPOSTgrant_type=authorization_code to exchange the code obtained in the previous step for an access token. Supporting grant_type=refresh_token would be beneficial but is not mandatory. The response should return a JSON object that includes access_token, token_type, expires_in, and optionally refresh_token.client_id=upfirstredirect_uri=http://localhost:8081/processclient_id and redirect_uri are valid and permitted for the specified client.npm installnpm startdependencies. It is recommended to use:
express for creating the server.jose or a similar library for handling JWT operations.devDependencies. You are free to use any tools for build, testing, and code formatting, such as eslint, prettier, or jest.