Skip to content

Credentials encoding differences between Environments#14

Merged
FraWolf merged 4 commits intodevfrom
feature/btoa-client-server
May 13, 2025
Merged

Credentials encoding differences between Environments#14
FraWolf merged 4 commits intodevfrom
feature/btoa-client-server

Conversation

@FraWolf
Copy link
Copy Markdown
Owner

@FraWolf FraWolf commented Apr 9, 2025

As title says, I have implemented a different method to calculate and encode credentials for OAuth2 flow. On node.js environment will be used Buffer, and, in the browser-client, will be used btoa() built-in method.


This pull request includes several changes to the codebase, primarily focusing on updating contributor information, adding a new utility function, and modifying the OAuth class to check the running environment. Below are the most important changes:

Contributor Information Update:

  • package.json: Updated the email addresses and URLs for contributors Francesco Lombardo and Luca Pattocchio.

Utility Function Addition:

  • src/adapters/utils.ts: Added a new function checkRunningEnvironment to determine if the code is running in a Node.js environment or a browser environment.

OAuth Class Enhancements:

  • src/contents/oauth/index.ts: Imported the new checkRunningEnvironment function and added a private environment getter in the OAuth class to utilize this function.
  • src/contents/oauth/index.ts: Modified the btoa method in the OAuth class to use Buffer for base64 encoding in a Node.js environment and btoa in a browser environment.

Repository owner deleted a comment from Kasui92 Apr 10, 2025
@Kasui92 Kasui92 self-assigned this May 10, 2025
@Kasui92
Copy link
Copy Markdown
Collaborator

Kasui92 commented May 13, 2025

@FraWolf
I've tested the changes in this playground and, aside from the usual Next.js magic of making things happen when they shouldn't, it actually solves the buffer problem.

@FraWolf FraWolf merged commit 5bc543d into dev May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants