Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nickw1/osm-oauth2-node-example
An extremely simple OSM OAuth2 Node example, intended for running on localhost only.
https://github.com/nickw1/osm-oauth2-node-example
Last synced: about 4 hours ago
JSON representation
An extremely simple OSM OAuth2 Node example, intended for running on localhost only.
- Host: GitHub
- URL: https://github.com/nickw1/osm-oauth2-node-example
- Owner: nickw1
- Created: 2024-03-01T20:42:50.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-01T20:44:08.000Z (11 months ago)
- Last Synced: 2024-11-17T12:45:34.223Z (2 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js OSM OAuth2 Client example
This is an example OSM OAuth2 client, using the `simple-oauth2` client library (available on npm). It's an absolute basic and simplified example; for reasons given below **it is intended for testing on localhost only, and must not be run on a production public server**.
I've put it together based on my reading of the OSM OAuth2 and `simple-oauth2` documentation. Note that the storing of the access token in a global variable is **absolutely not secure** (which hopefully is obvious, as all clients accessing the server will be able to use it). Thus, this example should **only be run on a development server on localhost which the outside world cannot access**. In a real production application you'd probably store the token in a session.
It's possible that the security could be improved in other ways; pull requests welcome.
Note the example endpoint `/osm/user` showing how you can send the access token in the headers and parse the XML to get the user details.