I have an API that responds to requests with a JSON that contains app updates and advertisements.
Requests are sent by my SDK that is implemented inside my game.
I need authentication because JSON responses contain some advertise provider keys that I don't want to be accessed by others(those who may send requests to API to access those tokens), so no one else than the game developer should be able to get responses from API.
SDK manages advertisements itself and game players have nothing to do with those data.
What's the best approach for implementing authentication for these SDK to API calls?
My idea is to use individual predefined tokens for each game SDK; I'm Not sure this is the best choice or not.
token 123
: developer1
with 100 users (one game)
token 456
: developer2
with 1000 users(one game)
Something like this:
SDK request to test.com/myapi/gameName
:
post: {
"token" : "123token"
}
and for game 2, we use another token:
post : {
"token" : "456token"
}
(123token
and 456token
are supposed to be predefined tokens in API for each game endpoint)
then API responds with a JSON content:
{
"gameTokens" : { ... } ,
...
}
A
sdk token123
users 4,000 and programmerB
sdk token456
users 120, or in total: (4,000 api-callers using token123
and 120 api-callers using token456
)?