{"id":13711,"library":"onedrive-api","title":"OneDrive API Client","description":"This package, `onedrive-api`, provides a functional programming-oriented interface for interacting with the Microsoft OneDrive API. It is designed for Node.js environments and facilitates operations such as file and folder management, link creation, and metadata retrieval. The current stable version is 1.1.1, which was last published in June 2019. Due to its age, it should be considered a legacy library, and its compatibility with the latest OneDrive API changes may be limited. The library focuses solely on API communication, advising users to handle authentication separately, with `simple-oauth2` being a suggested tool. It features a modular API for various item operations like `createFolder`, `uploadSimple`, and `listChildren`.","status":"abandoned","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/dkatavic/onedrive-api","tags":["javascript","onedrive","api","rest","skydrive","typescript"],"install":[{"cmd":"npm install onedrive-api","lang":"bash","label":"npm"},{"cmd":"yarn add onedrive-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add onedrive-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for making HTTP requests to the OneDrive API.","package":"got","optional":false},{"reason":"Runtime dependency for path manipulation.","package":"path","optional":false},{"reason":"Recommended for handling OAuth2 authentication flows with OneDrive, but not a direct runtime dependency.","package":"simple-oauth2","optional":true}],"imports":[{"note":"The library exports a default object containing all API methods, typically used in TypeScript or ESM.","wrong":"import { oneDriveAPI } from 'onedrive-api';","symbol":"oneDriveAPI","correct":"import oneDriveAPI from 'onedrive-api';"},{"note":"CommonJS require style for Node.js environments.","symbol":"oneDriveAPI","correct":"const oneDriveAPI = require('onedrive-api');"},{"note":"Individual API methods are nested under the `items` property of the main export, not top-level named exports.","wrong":"import { listChildren } from 'onedrive-api';","symbol":"items.listChildren","correct":"oneDriveAPI.items.listChildren({...});"}],"quickstart":{"code":"import oneDriveAPI from 'onedrive-api';\n\n// This library does not handle authentication. \n// You need to obtain an access token yourself, e.g., using simple-oauth2.\nconst accessToken: string = process.env.ONEDRIVE_ACCESS_TOKEN ?? 'YOUR_ONEDRIVE_ACCESS_TOKEN';\n\nif (!accessToken || accessToken === 'YOUR_ONEDRIVE_ACCESS_TOKEN') {\n  console.error('Please set the ONEDRIVE_ACCESS_TOKEN environment variable or replace the placeholder.');\n  process.exit(1);\n}\n\nasync function listRootChildren() {\n  try {\n    console.log('Attempting to list children of the root directory...');\n    const children = await oneDriveAPI.items.listChildren({\n      accessToken: accessToken,\n      itemId: 'root',\n      drive: 'me' \n    });\n    console.log('Children of root directory:');\n    children.value.forEach((item: any) => {\n      console.log(`- ${item.name} (ID: ${item.id}, Type: ${item.folder ? 'Folder' : 'File'})`);\n    });\n    // Uncomment for full response body: \n    // console.log(JSON.stringify(children, null, 2));\n  } catch (error) {\n    console.error('Failed to list children:', error);\n    if (error && typeof error === 'object' && 'response' in error) {\n      console.error('API Error Response:', error.response.body);\n    }\n  }\n}\n\nlistRootChildren();","lang":"typescript","description":"Demonstrates how to import the library and use the `listChildren` method to retrieve and log the names and types of items in the user's OneDrive root directory."},"warnings":[{"fix":"Consider using a more recently maintained OneDrive API client library or interacting directly with the OneDrive REST API.","message":"This package is currently abandoned and has not received updates since June 2019. It relies on outdated dependencies (e.g., `got` v9) and may not be compatible with the latest OneDrive API changes or Node.js versions.","severity":"breaking","affected_versions":">=1.1.1"},{"fix":"Integrate a separate OAuth2 client library (such as `simple-oauth2` as suggested by the README) to manage the authentication process and provide valid `accessToken` values to `onedrive-api` methods.","message":"The `onedrive-api` library explicitly does not handle authentication. You must implement your own OAuth2 flow to obtain and manage access tokens (e.g., refreshing expired tokens) before making any API calls.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Thoroughly test all API interactions and consult the official Microsoft Graph API documentation for OneDrive to ensure compatibility. Be prepared to implement workarounds or directly call the API if needed.","message":"The OneDrive API itself has undergone significant changes since 2019. This library might be using deprecated endpoints or data structures, potentially leading to unexpected errors or missing functionality for newer OneDrive features.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.1':48 '2019':55 'advis':86 'age':59 'api':2,8,22,74,84,104,116 'authent':90 'chang':75 'client':3 'communic':85 'compat':69 'consid':63 'createfold':110 'creation':39 'current':44 'design':25 'due':56 'environ':28 'facilit':30 'featur':101 'file':34 'focus':81 'folder':36 'function':11 'handl':89 'interact':17 'interfac':15 'item':107 'javascript':114 'june':54 'last':51 'latest':72 'legaci':65 'librari':66,80 'like':109 'limit':78 'link':38 'listchildren':113 'manag':37 'may':76 'metadata':41 'microsoft':20 'modular':103 'node.js':27 'oauth2':95 'onedr':1,7,21,73,115 'onedrive-api':6 'oper':31,108 'orient':14 'packag':5 'program':13 'programming-ori':12 'provid':9 'publish':52 'rest':117 'retriev':42 'separ':91 'simpl':94 'simple-oauth2':93 'skydriv':118 'sole':82 'stabl':45 'suggest':98 'tool':99 'typescript':119 'uploadsimpl':111 'user':87 'various':106 'version':46","created_at":"2026-04-20T01:55:55.107248+00:00","updated_at":"2026-04-20T01:55:55.107248+00:00","problems":[{"fix":"Ensure your OAuth2 flow properly refreshes access tokens before each API request and that the token has the necessary scopes for the operation.","cause":"The provided `accessToken` is no longer valid, has expired, or was never valid.","error":"Error: Access token invalid or expired"},{"fix":"Verify the correctness of the `itemId` or `itemPath`. Ensure the user associated with the `accessToken` has permissions to access the specified resource.","cause":"The `itemId` or `itemPath` specified in the request does not exist or is inaccessible to the authenticated user.","error":"Error: Request failed with status code 404 (Not Found) - { \"error\": { \"code\": \"itemNotFound\", \"message\": \"...\" } }"},{"fix":"When creating or uploading, specify a unique name or implement conflict resolution (e.g., by adding a timestamp to the name or handling `nameAlreadyExists` errors).","cause":"An operation like `createFolder` or `uploadSimple` was attempted with a name that already exists in the target location, and no conflict behavior was specified.","error":"Error: Request failed with status code 400 (Bad Request) - { \"error\": { \"code\": \"nameAlreadyExists\", \"message\": \"...\" } }"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dkatavic/onedrive-api","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/onedrive-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["azure","http-networking","communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}