What does HttpService:GetSecret() do?

Hello!

So I recently learned what the Secret data type is, and apparently it is what’s returned by HttpService:GetSecret(), but I’m not entirely sure what this does. The documentation page on it is blank besides the fact that it takes a string as a parameter.

If anyone knows, could you please inform me as to what it does? Thank you and have a wonderful day! :slight_smile:

4 Likes

“secret” is a new~ish datatype for storing variables outside of your code. They are encrypted and used for sensitive data. If you use github, they should function similarly to those. So basically they are mainly used to store sensitive API keys for https requests (one example).

github secrets: Using secrets in GitHub Actions - GitHub Docs

https://create.roblox.com/docs/cloud/open-cloud/oauth2-overview#roles-and-interaction-protocol

3 Likes

What exactly do you mean by this?

3 Likes

It’s used with the oauth stuff to store private keys not in your codebase where people could see it and abuse your game. So it’s stored off the game

3 Likes

Oh ok! How often should I use this if at all?

3 Likes

It’s used with the open cloud OAuth 2.0 Apps. So not for normal coding purposes

link to open cloud apps: https://create.roblox.com/dashboard/credentials?activeTab=OAuthTab

4 Likes

What exactly are API keys? I don’t have very much knowledge with anything outside of studio or anything dealing with APIs or datastores lol.

3 Likes

An API key is a password for two programs to communicate with eachother. So for example, lets say you have a website that sends data to your roblox game. You would only want yourself sending data to your game, and not datasigh because I could tamper with it. So an API key is a password that confirms the data is coming from the correct place. These keys have to be put in a secret because if you set them like this local SECRET_PASSWORD = "chickenNugget" you risk exploiters finding the key, and pretending to be you. Or any amount of mistakes that could happen.

2 Likes

Oh, ok, I get it now! Thank you so much! :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.