00:00
00:00
Newgrounds Background Image Theme

Burning78Omen34 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Newgrounds.io Help & Support

43,469 Views | 136 Replies
New Topic Respond to this Topic

Newgrounds.io is the successor to the old Newgrounds Flash API. We've completely re-built the server API to remove all dependencies on custom ActionScript classes.


Now, ANY platform should be able to use the API. The only requirements are the ability to encode and decode JSON objects, and post over HTTPS.


We already have some libraries available for platforms that target HTML5, and complete documents on how you can build your own libraries from any other platform.


Feel free to post any questions or help requests in this forum, or better yet, join our Discord group!


So far we are supporting:


  • Event & Referral Logging
  • Game Protection (site lock tools)
  • Medals
  • Scoreboards


Follow the project on Twitter as well, I'll be posting news and changes there!


------


Coming Soon:


  • Cloud Saves (aka cloud-based cookies)
  • CloudDB (will replace the old shared creations stuff, probably as a supporter only feature)


------


Other Updates:


  • The FlashAPI has reached end of support
  • Newgrounds.io is no longer in Beta
  • NG has removed Facebook and Google logins.

"Now, any user with a Newgrounds, Facebook or Google+ account can sign in to your game, no matter where it's running from!"

Is this saying it's possible to log in via a Facebook account that is not linked to a NG account? Do a linked FB and NG account both give the same User object?

Does `passport_url` mean that if they are not logged in or logged in via an unlinked(?) FB, this url gives them the option to log into NG? Does that notify the app in any way?

Edit: looked at your js example, answers the second question.

Response to Newgrounds.io Help & Support 2016-08-01 23:26:15


At 8/1/16 06:14 PM, MSGhero wrote: "Now, any user with a Newgrounds, Facebook or Google+ account can sign in to your game, no matter where it's running from!"

Is this saying it's possible to log in via a Facebook account that is not linked to a NG account? Do a linked FB and NG account both give the same User object?

Does `passport_url` mean that if they are not logged in or logged in via an unlinked(?) FB, this url gives them the option to log into NG? Does that notify the app in any way?

Edit: looked at your js example, answers the second question.

Users will need a Newgrounds account, but you can create one with FB and G+ and skip the oldschool registration form. Everything is powered by Newgrounds in the end, we just make it easily accessible to other social users.


When trying to submit score to scoreboard in javascript by callComponent('ScoreBoard.postScore'... I get "Unexpected server response" error.

Any suggestions?

Response to Newgrounds.io Help & Support 2016-08-08 13:55:29


At 8/6/16 08:56 AM, iv5 wrote: When trying to submit score to scoreboard in javascript by callComponent('ScoreBoard.postScore'... I get "Unexpected server response" error.

Any suggestions?

I'll need a bit more information to help you.

First, add this somewhere before you make the call:

ngio.debug = true;

Open the network inspector in your browser and run that call. Copy paste the response object you get from the server when the error happens and send it to me in a PM so I can see exactly what the server is getting/sending.


At 8/1/16 01:58 PM, PsychoGoldfish wrote: Now, ANY platform should be able to use the API. The only requirements are the ability to encode and decode JSON objects, and post over HTTP.

S! S!!
HTTPS!!!!

why do you want to give me a heart-attack D:

HTPS works, by the way. Thank you! Please make it default and update references to include the S. Most high-level languages handle that automatically, and anyone working in lower-level parts of a language where it actually matters should know better.

Also, HKPK (public key pinning) and HSTS wouldn't hurt, and it's not a lot of work. You've already alienated all the browsers that would allow downgrade attacks, so there's really no harm in adding a couple extra headers for more security.

An encrypted web is a happy web. We're over 50% there! Join us :D

Edit: Looking at the encryption, RC4 shouldn't really be used. AES-128 is a solid choice and isn't (yet) possibly broken whereas RC4 may be. Why not make AES the only option?

Although RC4 is specifically broken through TLS, it can be translated to other applications. Why take the risk?

I haven't yet looked at the encryption implementations, but if I find anything tomorrow I'll let you know.

Another edit: I appreciate the new platform, thank you very much :D


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to Newgrounds.io Help & Support 2016-08-18 11:31:25


At 8/18/16 01:21 AM, egg82 wrote:
At 8/1/16 01:58 PM, PsychoGoldfish wrote: Now, ANY platform should be able to use the API. The only requirements are the ability to encode and decode JSON objects, and post over HTTP.
S! S!!
HTTPS!!!!

why do you want to give me a heart-attack D:

HTPS works, by the way. Thank you! Please make it default and update references to include the S. Most high-level languages handle that automatically, and anyone working in lower-level parts of a language where it actually matters should know better.

Also, HKPK (public key pinning) and HSTS wouldn't hurt, and it's not a lot of work. You've already alienated all the browsers that would allow downgrade attacks, so there's really no harm in adding a couple extra headers for more security.

An encrypted web is a happy web. We're over 50% there! Join us :D

Going full https only was the original plan, but given that this platform is still targeted toward html5 games that can be distributed on various portal sites (most of which don't host games over SSL), we have most of the libraries simply not declaring the protocol and just posting to //newgrounds.io and letting the host site determine the protocol.

Many of the people that use our API tend to be entry level programmers and we just don't have the ability to hold everyone's hands when it comes to making SSL work for them on every possible host site.

Edit: Looking at the encryption, RC4 shouldn't really be used. AES-128 is a solid choice and isn't (yet) possibly broken whereas RC4 may be. Why not make AES the only option?

Although RC4 is specifically broken through TLS, it can be translated to other applications. Why take the risk?

I haven't yet looked at the encryption implementations, but if I find anything tomorrow I'll let you know.

The good news is there's really no secure information being used by our API at all. The RC4/AES encryption are primarily there for obfuscation purposes. RC4 is in there more for the poor saps still using ActionScript 2 to make Flash games. AES is the default (and preferred) encryption method.

Another edit: I appreciate the new platform, thank you very much :D

Glad you like it so far!


Haven't had time to play with anything yet, but it's on my to-do and I managed to look at some of the code while I was at work.

I have a couple questions/issues on some things:
Why is the AES/RC4 key provided by the application? Is that intentional for back-end magic, or can that just be replaced by an RSA implementation? (it really should if it can. Secure keys are unknown keys.) - also, why does the key need to be Base64-encoded? I'm not seeing anywhere that it's sent in plaintext to the server (at least, I hope it's not) but that does worry me slightly.. ?

RijndaelManaged by default uses CBC which is vulnerable to padding oracle attacks. (CBC specifically here)

Also, when sending encrypted messages over the wire it's important you make sure they maintain integrity from both accidental and malicious forces. Bouncy Castle provides AES-GCM.

I'm also curious about session_id being a public string. Why not just make it a UUIDv4 with a public accessor? Just make sure people know about section 6 of the RFC spec.

Ending note: Crypto is the reason I drink. Welcome to my world of pain.

Edit:
Oh, also about HTTPS- The host shouldn't determine whether or not HTTPS is used because that would defeat the point of it. There's no reason for it, either, since you can happily transmit secure data from an insecure location without problems. The reason I mention it being forced is because most people will use wrappers that handle those things automatically, and if they're not then they will be playing with a deeper part of the language and should know what they're doing by that point (or at least know how to use Google. "What does this 'TLS error' mean?") - anywhere in-between and honestly you have those same people asking those same questions anyway. Maybe just add it into an FAQ of some sort and reference it where possible?


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to Newgrounds.io Help & Support 2016-09-07 18:09:02


A tiny question...
If I understand this correctly, I could theoretically make a game in C++ and implement the Newgrounds API there?

Anyhow this is truly amazing and I am really looking forward to future updates.


BBS Signature

Response to Newgrounds.io Help & Support 2016-09-07 18:11:01


At 9/7/16 06:09 PM, Pkmn2 wrote: A tiny question...
If I understand this correctly, I could theoretically make a game in C++ and implement the Newgrounds API there?

Anyhow this is truly amazing and I am really looking forward to future updates.

Yes, you can make a client for our API in any language that has JSON support and can post to a web address.


At 9/7/16 06:09 PM, Pkmn2 wrote: A tiny question...
If I understand this correctly, I could theoretically make a game in C++ and implement the Newgrounds API there?

Yep. That's very much possible, and isn't all that difficult**.

I'm also working on a backend framework for creating game servers (or any other type of server, really) that communicates with the client using the WebSocket protocol and am including ways of linking it to the NGAPI. I have a repo of it uploaded—it's not as up-to-date as the source on my computer but it still works.

And that's my shameless plug for the day.

** It's not difficult, but can be rather tedious due to the nature of C++.

Response to Newgrounds.io Help & Support 2016-09-08 12:28:30


At 9/8/16 11:19 AM, Diki wrote: I'm also working on a backend framework for creating game servers (or any other type of server, really) that communicates with the client using the WebSocket protocol and am including ways of linking it to the NGAPI.

Thanks for sharing.
I am extremely far away in adding online support to my game, since it's my very first time making one in C++.
But it's cool to hear, that something like this is possible.


BBS Signature

Response to Newgrounds.io Help & Support 2016-09-18 16:26:12


Hi guys,
Im trying to add highscore board to my unity webgl game.
I am using the newgrounds.io for unity available in https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c
I think I know how to post a score, Im using something like this:

public void submithethescore()
{
io.newgrounds.components.ScoreBoard.postScore submit_score = new io.newgrounds.components.ScoreBoard.postScore();
submit_score.id = 6666;
submit_score.value = 100;
submit_score.callWith(ngio_core);
}

But I am having problems with the code of retrieving the scores (getScores).
Can someone please show me a C# example of how would be a function to retrieve and list all scores of a specific scoreboard.

Thx very much.

Response to Newgrounds.io Help & Support 2016-09-20 11:27:51


At 9/18/16 04:26 PM, ballpreta wrote: Hi guys,
Im trying to add highscore board to my unity webgl game.
I am using the newgrounds.io for unity available in https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c
I think I know how to post a score, Im using something like this:

public void submithethescore()
{
io.newgrounds.components.ScoreBoard.postScore submit_score = new io.newgrounds.components.ScoreBoard.postScore();
submit_score.id = 6666;
submit_score.value = 100;
submit_score.callWith(ngio_core);
}

But I am having problems with the code of retrieving the scores (getScores).
Can someone please show me a C# example of how would be a function to retrieve and list all scores of a specific scoreboard.

Thx very much.

You'll want something like this:

void onScoresLoaded(io.newgrounds.results.ScoreBoard.getScores result) {
if (result.success) {
// result.scores is a list of score objects
for (int i = 0; i < result.scores.Count; i++)
{
// this object contains all the score info, and can be cast to a proper model object.
io.newgrounds.objects.score score = (io.newgrounds.objects.score)r.scores[i];
}
}
else
{
// there was a problem talking to the server. Details should be in result.error.message
}
}

void loadScored(int board_id) {
io.newgrounds.components.ScoreBoard.getScores get_scores = new io.newgrounds.components.ScoreBoard.getScores();
get_scores.id = board_id;

// configure additional score settings such as get_scores.limit, get_scores.period, get_scores.social, etc here

get_scores.callWith(ngio_core, onScoresLoaded);
}

Response to Newgrounds.io Help & Support 2016-11-23 01:52:40


Hello!

I'm attempting to get the Newgrounds.io working with my Unity WebGL game. Whenever I try to post a score I get a null thrown. Any idea what I may be doing wrong? Does the game need to be published to test leaderboards and medals?

I've attached a screenshot below it seems a call is being made, but throws an exception.

Let me know if you need anything else. Thanks!

Newgrounds.io Help & Support

Response to Newgrounds.io Help & Support 2016-11-23 15:44:09


At 11/23/16 01:52 AM, LunaWolfStudios wrote: Hello!

I'm attempting to get the Newgrounds.io working with my Unity WebGL game. Whenever I try to post a score I get a null thrown. Any idea what I may be doing wrong? Does the game need to be published to test leaderboards and medals?

I've attached a screenshot below it seems a call is being made, but throws an exception.

Let me know if you need anything else. Thanks!

*Resolved
My Newgrounds Core wasn't attached to the correct game object and so the StartCoroutine(_executeCallList(single_call)); was causing a crash as you need an object to execute a co-routine.

Response to Newgrounds.io Help & Support 2016-12-14 19:13:49


At 8/1/16 01:58 PM, PsychoGoldfish wrote: Newgrounds.io is the successor to the old Newgrounds Flash API. We've completely re-built the server API to remove all dependencies on custom ActionScript classes.

Hi just wondering I'm an as2 game designer and I have implemented medals in my games before, I've been trying to add them to a new game I'm working on but I'm getting failed to unlock medal every time?
does this new api have something to do with it?

Response to Newgrounds.io Help & Support 2016-12-18 08:26:02


Hi,

I was wondering if there is any updates to the new api for GameMaker, since looks like the old one using the unnoficial HTML5 version is not working again, freezing the game when a medal is called.

Some months ago I was really trying to get the v3 api to work with game maker but got stuck I have a nearly completed game in game maker and I really would like some medals.


It's good to learn something new every day!

Trying to develop games, music and art.

Follow my work!

Response to Newgrounds.io Help & Support 2017-01-09 13:11:33


can this work for html games?

Response to Newgrounds.io Help & Support 2017-01-13 03:31:53


At 1/9/17 01:11 PM, NightRaid-NG wrote: can this work for html games?

there is an example in Here but it depends on what you are using to make the game, now I'm struggling to make this work with game maker.

Unity uses another set of files to comunicate with the server,


It's good to learn something new every day!

Trying to develop games, music and art.

Follow my work!


So there it is one of my tests with game maker, I managed to greet the user if it is connected, and now I'm trying to get the medal. For some reason this happens, Don't mind the "medal_name = null;" that is defined inside the game maker, so It can be edited from inside the engine when you call the function.

Newgrounds.io Help & Support


It's good to learn something new every day!

Trying to develop games, music and art.

Follow my work!

Response to Newgrounds.io Help & Support 2017-01-13 07:59:34


At 1/13/17 03:31 AM, Raeldor wrote:
At 1/9/17 01:11 PM, NightRaid-NG wrote: can this work for html games?
there is an example in Here but it depends on what you are using to make the game, now I'm struggling to make this work with game maker.

Unity uses another set of files to comunicate with the server,

I use rpg maker mv

Response to Newgrounds.io Help & Support 2017-01-13 10:14:17


At 1/13/17 05:10 AM, Raeldor wrote: So there it is one of my tests with game maker, I managed to greet the user if it is connected, and now I'm trying to get the medal. For some reason this happens, Don't mind the "medal_name = null;" that is defined inside the game maker, so It can be edited from inside the engine when you call the function.

Make sure NG_loadMedals has been called and received a response before you try unlocking anything.


Hello, Everyone.

I tried to upload HTML5 game using the v3 API. The game currently is still in Preview phase.
When I tried to add medal in firefox, the console displays this message:

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://newgrounds.io/gateway_v3.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘none’)"

It happened similarly when I used Chrome.
Also, the session and medal were loaded successfully.

Solution for this? Thank you.

Edit:

@Raeldor:
I know this is very late, but from your case, it is because the "medal[i]" is supposed to be "medals[i]".
The one from the example (newgrounds io) has typo that needs fix, since I experienced it the same error.

Response to Newgrounds.io Help & Support 2017-06-15 13:03:04


Hi, is this the right forum for questions and support or the Google group? Google group is linked in the official guide, but there's no one around answering questions.

Response to Newgrounds.io Help & Support 2017-06-25 08:16:57


I just tell about my problem now here and in the Google group. Perhaps someone in charge reads it.

I have the issue that my calls to the API get blacklisted. Please take a look: http://www.newgrounds.com/projects/games/1109814/preview - password is v3beta
If you play the game, you will see that it does not do many calls but already the second call (when a game is started) normally gets rejected. Users won't be enthusastic if their medals and scores were not submitted. :-(

Benjamin

Response to Newgrounds.io Help & Support 2017-08-05 00:34:12


I posted this over on the level1techs forum (what is left of the Tek Syndicate group on YT) in the hopes that some more people will help with this. I would if I could but its a bit above what I know :P

Hopefully more people jump onto this.


PH4NT0M117

BBS Signature

Response to Newgrounds.io Help & Support 2017-12-08 20:47:31


Hi,

I'm trying to use post score and unlocking medals in Unity.
When I preview my project, i get these responses from the API in the browser console:

Call failed local validation:
{"component":"Medal.unlock","parameters":{},"secure":""}
---
Local Response:
{"medal":{"difficulty":0,"id":0,"secret":false,"unlocked":false,"value":0},"medal_score":0,"component":"Medal.unlock","success":false,"error":{"code":0,"message":"Medal.unlock requires a valid user session."}}
---

I followed the steps on https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/

My code:

io.newgrounds.components.Medal.unlock medal_unlock = new io.newgrounds.components.Medal.unlock();
medal_unlock.id = 53616;
medal_unlock.callWith(ngio_core);

Is the API supposed to work or give different responses when play via the project-preview? I'd like to test my stuff before I put it live :)

Response to Newgrounds.io Help & Support 2017-12-13 11:46:38


At 12/8/17 08:47 PM, dynamitewhale wrote: Hi,

I'm trying to use post score and unlocking medals in Unity.
When I preview my project, i get these responses from the API in the browser console:

Call failed local validation:
{"component":"Medal.unlock","parameters":{},"secure":""}
---
Local Response:
{"medal":{"difficulty":0,"id":0,"secret":false,"unlocked":false,"value":0},"medal_score":0,"component":"Medal.unlock","success":false,"error":{"code":0,"message":"Medal.unlock requires a valid user session."}}
---

I followed the steps on https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/

My code:

io.newgrounds.components.Medal.unlock medal_unlock = new io.newgrounds.components.Medal.unlock();
medal_unlock.id = 53616;
medal_unlock.callWith(ngio_core);

Is the API supposed to work or give different responses when play via the project-preview? I'd like to test my stuff before I put it live :)

The key part is the error you are getting back:
"error":{"code":0,"message":"Medal.unlock requires a valid user session."}

If the user isn't signed in, they can't unlock anything. See https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/#markdown-header-using-newgrounds-passport for information on how to sign a user in.


At 12/13/17 11:46 AM, PsychoGoldfish wrote:
The key part is the error you are getting back:
"error":{"code":0,"message":"Medal.unlock requires a valid user session."}

If the user isn't signed in, they can't unlock anything. See https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/#markdown-header-using-newgrounds-passport for information on how to sign a user in.

When I am testing the game in the preview mode, I am logged in.
How can I test the API in the preview stage?

---
Do I need to start a session manually for badges to work? http://www.newgrounds.io/help/components/#app-startsession
Or does the core take care of that?`(there is somce code there that looks like it initializes the session on Start())