Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

client-oauth breaks on Edge runtime because of window.btoa #206

Open
@korsvanloon

Description

@korsvanloon

The Edge runtime neither has access to Buffer nor window. It does however has access to btoa directly.

I'm using it in my NextJS middleware that runs on the Edge middleware

If I change it like this it works fine for me. And I don't think it'll break any other scenario, right?

- var btoa
if (typeof Buffer === 'function') {
  btoa = btoaBuffer
+ } else if(typeof window !== 'undefined') {
  btoa = window.btoa.bind(window)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions