# automate-oauth-flows-streamline-publishing
Source: https://speakeasy.com/blog/automate-oauth-flows-streamline-publishing


import { Callout } from "@/lib/mdx/components";

This week, we're excited to announce two major improvements to the Speakeasy platform: enhanced OAuth support and a more flexible publishing workflow. These updates are designed to make your API integration process smoother and more efficient than ever before.

## OAuth Authorization Flow Support with Custom Security Schemes

```typescript
import { SDK } from "SDK";

const sdk = new SDK();

async function run() {
  const result = await sdk.oAuth2.getToken(
    {
      Id: process.env["SDK_ID"] ?? "",
      Secret: process.env["SDK_SECRET"] ?? "",
    },
    {
      grantType: "authorization_code",
      code: "1234567890",
      redirectUri: "https://example.com/oauth/callback",
    },
  );

  // Handle the result
  console.log(result);
}

run();
```

We've introduced robust support for OAuth authorization flows using custom security schemes. This new feature allows for greater flexibility in implementing various OAuth flows, particularly the Authorization Code flow.

Key improvements include:

- Custom Security Schemes: Define your own security scheme to match your specific OAuth implementation.
- Flexible Secret Handling: Support for various formats of client ID and secret combinations.
- Pre-Request Hooks: Customize request headers and parameters before they're sent to the server.

This enhancement makes it easier than ever to integrate OAuth-protected APIs into your projects, with the SDK handling the complexities of token exchanges and header generation.

---

## Streamlined Publishing Workflow

![Manually trigger publishing](/assets/blog/publishing.png)

We've completely revamped our publishing workflow to give you more control and flexibility. Now, you can publish your SDK without being tied to GitHub-specific generation processes.

Here's what's new:

- **Decoupled from GitHub Actions**: Publish directly from your branch, regardless of where the last generation occurred (local, GitHub, etc.).
- **Simplified First-Time Publishing**: Follow a straightforward process: `quickstart` → configure GitHub → push to repo → kick off publishing.
- No-Op for Existing Versions: If you attempt to publish a version that's already been released, the system will automatically skip the process, preventing accidental overwrites.

This update eliminates the need to regenerate in GitHub Actions or worry about forcing changes. It's now easier than ever to get your SDK published and into the hands of your users.

---

## 🐝 New features and bug fixes 🐛

<Callout title="Note" type="info">
  Based on the most recent CLI version: [**Speakeasy
  v1.418.4**](https://github.com/speakeasy-api/speakeasy/releases/tag/v1.418.4)
</Callout>

### TypeScript

🐛 Fix: error handling in SSE methods \
🐛 Fix: support for gracefully aborting SSE streams

### Python

🐝 Feat: export `__title__`, `__version__` and `VERSION` values from the root of a python package \
🐛 Fix: error handling in SSE methods \
🐛 Fix: support for gracefully aborting SSE streams \
🐛 Fix: address pydantic `union_tag_invalid` errors on Python 3.11 and later

### Go

🐛 Fix: ensure response body is closed after reading \
🐛 Fix: ensure OAuth2 client credentials hook logic is valid for multiple security schemes

### Java

🐛 Fix: support union of arrays (account for erasure)

### PHP

🐝 Feat: PHP Complex Number support (bigint and decimal) \
🐝 Feat: const and default support added