
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@vehikl/igloo-server-proxy
Advanced tools
This server should emulate igloo's proxy server for testing purposes
This server should emulate igloo's proxy server for testing purposes
If you are working on an older widget, you might need to specifically use the legacy branch, which is not public.
Wrap your application bundler in an express app so all urls are relative/local. Use this for igloo widget repos when possible.
npm install --save @vehikl/igloo-server-proxy
# OR
yarn add @vehikl/igloo-server-proxy
import configureIglooServerProxy from "igloo-server-proxy"
import * as express from "express"
const HTTP_PORT = 3000
const app = express.app()
const proxyOptions = {
useLegacy: true,
servicesPath: 'path/to/services'
};
configureIglooServerProxy(app, HTTP_PORT, proxyOptions)
// app - express server
// HTTP_PORT - the port express is serving on
// proxyOptions.useLegacy - load up <host>/<service name>/* oauth endpoints
// proxyOptions.servicesPath - load service config json files from this absolute path
server.listen(HTTP_PORT)
Services should contain the following json:
{
"clientID": "some-client-id-from-service",
"clientSecret": "some-client-secret-from-service",
"site": "http://the-site-where-oauth-happens",
"authorizationPath": "full/path/to/oauth/authorize",
"tokenPath": "full/path/to/oauth/token",
"scope": "Any.scopes Defined.by The.service OrA.EmptyString",
"resource": "optional/resource",
"callbackPath": "optional/callback/path",
"applicationIds": ["ig-name-of-thing"]
}
Both resource
and callbackPath
are optional, and can be omitted.
authorizationPath
and tokenPath
can be full URLs if they are not prefixed by the same site
.
If the path starts with http://
or https://
, it will be considered a full URL, otherwise, site
will be prefixed to create a full URL.
It is important that the applicationIds match what the widget is submitting so it knows what service to map things to.
To easily add a service, you can use:
npx @vehikl/igloo-server-proxy new
Otherwise service json files are created in constants.js#DEFAULT_SERVICES_PATH.
Tokens get persisted, and by default, should be stored in ~/.igloo-proxy-tokens.json
.
To test refresh flow, log into a service, so the token is properly stored.
Then open ~/.igloo-proxy-tokens.json
, find the appropriate service, then set ig-yourservice.access_token
to either an empty string, or update it with new characters (making the access token invalid).
Now refresh the web app, and you should see an initial 401 call through the proxy, followed by the refresh flow.
All new OAuth endpoints are prefixed with /.api2/api/v1/communities/{communityKey}/oauth2
.
If the server has useLegacy
set to true, there will also be endpoints for /{service-name}
, but these should not be relied on.
Note that the legacy endpoints are not 1:1 for the newer igloo emulation, only use those if necessary with older widgets.
This endpoint will redirect to the oauth sign-in page, and is often in a pop-up window.
Parameters:
Name | Required? | Description | Value |
---|---|---|---|
applicationId | Yes | Value mapping to your service.json file | ig-{servicename} |
authorizeUri | Yes | Full service authorize URL | https://some-service.com/oauth2/authorize |
tokenUri | Yes | Full service get token URL | https://some-service.com/oauth2/token |
scope | Yes | OAuth scope specification. See your oauth provider's documentation for real values. | May contain values like email profile |
tokenSubKey | No | Some services require a token sub key, in instances where igloo has two matching applicationIds. | Unknown |
Response:
HTTP Status Code | Description | Body |
---|---|---|
200 OK | Success | None |
4xx | Authentication Error | None |
Anything else | Server Error | None/Server Message? |
This endpoint retrieves manages the current oauth tokens
The GET
variant retrieves it, the DELETE
variant will remove it.
Parameters:
Name | Required? | Description | Value |
---|---|---|---|
applicationId | Yes | Value mapping to your service.json file | ig-{servicename} |
Response:
HTTP Status Code | Description | Body |
---|---|---|
200 OK | Success | (Using GET ) { access_token: A, refresh_token: B, expiresAt: C } |
4xx | Authentication Error | None |
Anything else | Server Error | None/Server Message? |
This endpoint retrieves the current access and refresh tokens associated with the service.
This will refresh the tokens in the igloo server, but will require a secondary call to GET {prefix}/token
to get the updated tokens.
JSON Body:
Name | Required? | Description | Value |
---|---|---|---|
ApplicationId | Yes | Value mapping to your service.json file | ig-{servicename} |
RefreshToken | Yes | The refresh token, from GET {prefix}/token | An OAuth token |
RefreshTokenURI | Yes | Full service refresh token URL | https://some-service.com/oauth2/refresh |
Headers:
Name | Required? | Description | Value |
---|---|---|---|
Content-Type | Yes | Tell the server the post body format | application/json |
Response:
HTTP Status Code | Description | Body |
---|---|---|
200 OK | Success | None |
4xx | Authentication Error | None |
Anything else | Server Error | None/Server Message? |
http://your-server-proxy-address:port/.api2/api/v1/communities/{your-community-key}/oauth2/callback
http://localhost:3000/.api2/api/v1/communities/igloo-key==/oauth2/callback
FAQs
This server should emulate igloo's proxy server for testing purposes
We found that @vehikl/igloo-server-proxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.