Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
This project is a Node.js library consisting of a client for interacting with Coursera's OAuth2 authorizes APIs.
Install Node.js from Install npm from Clone project, open terminal, go to project directory, run in terminal 'mvn package', you can find jar in $project_dir/target/ folder.
Before using Coursera's OAuth2 APIs, be sure you know your client id, client secret, and scopes you want for your application. You may create an application at https://accounts.coursera.org/console. When creating the application, set the Redirect URI to be http://localhost:9876/callback?client_id=<your_client_id>.
Usage
Build jar file by command 'mvn package'
, import jar to your project and create new object:
::
CourseraOAuth2Service service = new CourseraOAuth2ServiceImpl();
service.addClient(clientName, clientId, clientSecret, scopes); // add new client configuration
service.generateOAuth2Tokens(clientName); // generate authentication tokens
String accessToken = service.getAccessToken(clientName); // get access token
The Coaclient tries to open the default system browser (If this step fails, the Coaclient suggests to open a link in the browser manually). The application configuration will be saved to the local file if the request is succeeded. You should check the data you've provided to the library during application configuration if you see any errors in the browser.
If client was successfully added and configured, you will be able to successfully get authentication tokens for Coursera API. Otherwise, an exception will be thrown telling you to set up your application for API access.
public interface CourseraOAuth2Service
Interface CourseraOAuth2Service
specifies the interface for an object that manage client config and returns Coursera authentication tokens.
Implementations: public class CourseraOAuth2ServiceImpl
Methods: :: void addClient(String clientName, String clientId, String clientSecret, String scope) throws CreateClientAppException;
Create a new client config and save it to the local config file: <home.dir>/.coursera/coaclient.csv
Parameters:
::
clientName - Client Name
clientId - Coursera Client ID
clientSecret - Coursera Client Secret Key
scope - by default used "view_profile", for business use "access_business_api".
Throws:
CreateClientAppException
- if any error occured while creating client config
:: void deleteClient(String clientName);
Delete client config from file: <home.dir>/.coursera/coaclient.csv
and auth token file from <home.dir>/.coursera/<client_name>_oauth2.csv
:: void generateOAuth2Tokens(String clientName) throws TokenNotGeneratedException;
By default starting server callback listener and get auth tokens from Coursera OAuth API.
Throws:
TokenNotGeneratedException
- if any error occured while generating OAuth2 tokens
:: Map<String, String> getAuthTokens(String clientName);
Returns:
Map with refresh, access tokens and expired time from auth token file: <home.dir>/.coursera/<client_name>_oauth2.csv
.
:: String getAccessToken(String clientName);
Returns:
Access token by client name from auth token file: <home.dir>/.coursera/<client_name>_oauth2.csv
.
:: List getClients();
Returns:
List of client config from local file: <home.dir>/.coursera/coaclient.csv
.
:: void startServerCallbackListener() throws TokenNotGeneratedException;
Start server on default port '9876' for callback listener
Throws:
TokenNotGeneratedException
- if any error occured while starting server listener
:: void stopServerCallbackListener();
Please use the Github issue tracker to document any bugs or other issues you encounter while using this tool.
FAQs
Execute Node.js library for manage CourseraOAuth2 API tokens
The npm package coaclient receives a total of 3 weekly downloads. As such, coaclient popularity was classified as not popular.
We found that coaclient demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.