Quickstart

Need somewhere to start? You're in the right place!

If you've ever implemented a "Login with Facebook/Twitter/Discord/Etc" system into an app or game before, you'll be right at home integrating HYPLAY, but if not this guide will get you up and running in about 10 minutes. Make sure you join the Discord server if you've got questions. Someone is usually on hand to help out!

Your Application

Full Guide: https://docs.hyplay.com/docs/app-registration
Everything on HYPLAY revolves around an Application. The first thing we're going to do is create one - but before we can get started, you need a HYPLAY user! If you haven't already signed up for HYPLAY, do so now at https://hyplay.com/auth. Copy down the access token, you'll need it to create an app.

Instructions for Unity: https://docs.hyplay.com/docs/unity-plugin
COMING SOON - Instructions for the developer home page.

You app needs the following:

  • an icon, square - preferably 512x512 or higher resolution
  • a background, 16:9 ratio
  • a name
  • a description (it must be longer than 20 characters)
  • at least one redirect uri - this is typically the location your app is hosted. [[Instructions for Itch.io]]

We'll need to upload our icon and background first, we can do this through the API explorer, or programmatically, using the create asset endpoint: https://docs.hyplay.com/reference/createasset

You'll need the access token you copied eariler, and you should convert your icon and background image to a base64 string. You can use tools like https://elmah.io/tools/base64-image-encoder/ to convert an image to a base64 string.

You'll need to submit a create request for each image asset uploaded. Copy the returned id in the response from the create asset endpoint for the created icon and background. At this point, you should use the API explorer to create your app: https://docs.hyplay.com/reference/createapp

You'll need to provide the id or the created icon image, and background image, as well as a name and description and at least 1 approved redirect uri.

The developer backend is currently under maintenance, and will greatly improve this flow. We'll post a message on Discord and update the docs as soon as it is ready.

Logging In - OAuth Setup

Now it's time to log your players in. If you are familiar with the oauth flow, check out the Oauth URL Construction guide. If not, read on!

For this guide, we're going to use the following URL. You'll need to modify this for your application: https://hyplay.com/oauth/authorize/?appId=YOUR_APP_ID_HERE&chain=HYCHAIN_TESTNET&responseType=token&redirectUri=YOUR_REDIRECT_URI_HERE

  • For appId replace the YOUR_APP_ID_HERE with the id of your created app from the previous step.
  • For chain, this is the blockchain that a user using this authorization flow is approving permissions for. In this case it's HYCHAIN's testnet - which is a testing environment. For mainnet (production environment) you can use HYCHAIN.
  • For responseType we've used a value of token - this means the redirectUri will have the access token returned in the redirect as a url fragment (#). This is also known as an implicit auth flow.
  • For redirectUri replace the YOUR_REDIRECT_URI_HERE with a approved redirect uri you set when creating your application. This is where a user will be redirected to once completing or cancelling the flow.

Here's where to find all the query parameters you can configure for your OAuth URL: https://docs.hyplay.com/docs/auth-url-construction#oauth-url-construction

To test this, you can just put the link you've constructed into the browser and try logging in. Once you've logged in, you will be redirected back to the provided redirectUri. In the redirected url, you'll see an access token after the fragment (#) in the url. Your application can parse this out of the URL to retrieve it.

After you've retrieved an access token, you'll probably want to their details - id, username, etc. You can quickly get the this information with the get current user endpoint: https://docs.hyplay.com/reference/getcurrentuser.

If you've got any questions, send us a message on Discord and we'll be able to help you straight away.