Uploaded January 2023 | Updated November 2026, 3 hours ago
Square OAuth Best Practices - developer.squareup.com/docs/oauth-api/best-practices#manage-use-and-store-tokens-securely
Square OAuth API - developer.squareup.com/docs/oauth-api/overview
When building an OAuth integration, it's very important that you encrypt the access tokens you obtain before storing them. It'll help protect you and your app's users.
OAuth access tokens, refresh tokens, and the application secret all have privileged access (or the potential to get privileged access) to seller resources. You should use them in a secure environment and protect access to them following best practices.
In this example we'll show how to encrypt using Node JS, but each language has their own libraries for encrypting and the process should be roughly the same.
00:00:00 - Introduction
00:00:11 - Importance of Encrypting Access Tokens
00:00:35 - Node Crypto Library Functions Overview
00:00:57 - Importance of Protecting the Encryption Key
00:01:15 - Encrypting Tokens: The Create Cipher IV Function
00:01:47 - Encryption Process Details
00:02:08 - Completing the Encryption Process
00:02:29 - Returning the IV and Encrypted Token
00:02:49 - Decrypting Tokens: Overview
00:03:12 - Decrypting Tokens: Step-by-Step Process
00:03:33 - Practical Example: Encrypting a Token
00:03:53 - Output Demonstration: Encrypted Token
00:04:15 - Decrypting the Encrypted Token
00:04:39 - Conclusion and Reminder to Protect Encryption Keys
Square Developer Community - https://squ.re/slack
Square Developer Twitter - twitter.com/squaredev
Square Developer Forums - developer.squareup.com/forums
Square OAuth Best Practices - developer.squareup.com/docs/oauth-api/best-practices#manage-use-and-store-tokens-securely
Square OAuth API - developer.squareup.com/docs/oauth-api/overview
When building an OAuth integration, it's very important that you encrypt the access tokens you obtain before storing them. It'll help protect you and your app's users.
OAuth access tokens, refresh tokens, and the application secret all have privileged access (or the potential to get privileged access) to seller resources. You should use them in a secure environment and protect access to them following best practices.
In this example we'll show how to encrypt using Node JS, but each language has their own libraries for encrypting and the process should be roughly the same.
00:00:00 - Introduction
00:00:11 - Importance of Encrypting Access Tokens
00:00:35 - Node Crypto Library Functions Overview
00:00:57 - Importance of Protecting the Encryption Key
00:01:15 - Encrypting Tokens: The Create Cipher IV Function
00:01:47 - Encryption Process Details
00:02:08 - Completing the Encryption Process
00:02:29 - Returning the IV and Encrypted Token
00:02:49 - Decrypting Tokens: Overview
00:03:12 - Decrypting Tokens: Step-by-Step Process
00:03:33 - Practical Example: Encrypting a Token
00:03:53 - Output Demonstration: Encrypted Token
00:04:15 - Decrypting the Encrypted Token
00:04:39 - Conclusion and Reminder to Protect Encryption Keys
Square Developer Community - https://squ.re/slack
Square Developer Twitter - twitter.com/squaredev
Square Developer Forums - developer.squareup.com/forums








![Main Stage | Small World Seafood
With the help of a software designer, a Square agency partner, and Square Online, Robert Amar was able to pivot from a wholesale seafood distributor to direct-to-consumer seafood sales during the restaurant closures and restrictions of 2020.
Learn how Robert started Small World Seafood with his Philadelphia neighbors, set up his Square Online site with help from Square agency partner Scope, and caught a loyal customer base hungry for fresh fish.
[TRANSCRIPT]
Robert: To get fresh fish in front of people is really exciting.
What I love the most about seafood is the variety, the flavors, the seasons, the areas things come from.
On March 16, 2020, when the city shut down, I had seafood. I emailed my block and I said: “Hey listen, I’ve got all this seafood here. And it’s free. Come by tomorrow and pick it up.”
We pivoted from being wholesalers to going right to people. In hindsight, you know, we’re geniuses.
But the reality is me and Andy just hopped on a raft that was racing by on this rapid river, and we were just trying to figure out how to survive on it.
As we’re growing we’re still doing things on pen and pencil. We couldn’t verify who was even paying at some point.
So we needed to look for options, and that’s when we found Dylan and Square.
Dylan: Working with Robert was really personal because we both were from Philly. My name is Dylan Mullan, and I helped Small World Seafood launch their Square Online site.
The solution I proposed was to design a website that had all the information on his pickups, his delivery times.
It had his ever-changing menu so he could update it daily, based on his current selection. So the influx of orders that he gets are much more organized.
He can collect payment immediately.
Robert: Once we pull our truck up to a location, we needed something that we can look at and go, “Boom! This is what we need. This is how much we have to sell.”
That was really, really helpful.
Dylan: I love building with Square because I get to help small businesses like Robert’s grow.
Robert: COVID-19,you know, it brought a lot of us together. We started to spend more time with the people that we really cared about. Main Stage | Small World Seafood](https://i.ytimg.com/vi/7UvNsECAC18/mqdefault.jpg)

