<p>This sample shows how to compose a middleware component with a business logic component using <a href="https://www.fermyon.com/blog/introducing-spin-v2">Spin 2.0</a> and the Component Model. </p> <h2>Instructions</h2> <h3>Install Prerequisites</h3> <ul> <li>Install <a href="https://github.com/bytecodealliance/cargo-component"><code>cargo component</code></a>:</li> </ul> <pre><code class="language-bash">cargo install --git https://github.com/bytecodealliance/cargo-component cargo-component </code></pre> <ul> <li>Install a fork of <a href="https://github.com/dicej/wasm-tools/tree/wasm-compose-resource-imports">wasm-tools</a>:</li> </ul> <pre><code class="language-bash">cargo install --git https://github.com/dicej/wasm-tools --branch wasm-compose-resource-imports wasm-tools --locked </code></pre> <ul> <li>Install latest <a href="https://developer.fermyon.com/spin/v2/install">Spin</a></li> <li>Create an OAuth App in your <a href="https://github.com/settings/developers">GitHub Developer Settings</a>. <ul> <li>Set the callback URL to <code></code>. </li> <li>Accept defaults and input dummy values for the rest of the fields.</li> <li>Save the Client ID</li> <li>Generate a new Client Secret and save that as well</li> </ul> </li> </ul> <h3>Build And Run The Spin App</h3> <pre><code class="language-bash"># Build the middleware cargo component build --manifest-path github-oauth/Cargo.toml --release # Build and run the example spin up --build -f example -e CLIENT_ID=&lt;YOUR_GITHUB_APP_CLIENT_ID&gt; -e CLIENT_SECRET=&lt;YOUR_GITHUB_APP_CLIENT_SECRET&gt; # Open in a browser # Deploy to Fermyon Cloud spin cloud deploy </code></pre> <h2>Running with Wasmtime</h2> <p>Please visit the [G]itHub repository](https://github.com/fermyon/http-auth-middleware#running-with-wasmtime) for detailed instructions on how to run with Wasmtime. </p>