I've been trying to connect passing the token correctly and I always get
the same error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}}
My code is:
function start() {
alert("paso");
gapi.client.init({
apiKey: 'AIza***********************',
clientId: '415249084355-01r************************',
// discoveryDocs: 'https://www.googleapis.com/games/v1/',
scope: 'https://www.googleapis.com/auth/games',
})
// gapi.client.setToken(idtok);
// Loading is finished, so start the app
.then(function() {
gapi.client.load('games', 'v1', function(response) {
var request = gapi.client.games.leaderboards.list(
{maxResults: 5} );
request.execute(function(response) {
console.log("esta es la respuesta list" + response);
});
});
gapi.client.load('games', 'v1', function(response) {
alert("paso2");
userIdToken = firebase.auth().currentUser.getIdToken();
gapi.client.setToken(userIdToken);
gapi.client.setApiKey('AIzaSyDsWd6D**************************');
// 3. Initialize and make the API request.
gapi.client.request({
path:
'https://www.googleapis.com/games/v1/achievements',
methods:
'https://www.googleapis.com/games/v1/achievements',
params: { language: 'es-ES', maxResults: 150,
pageToken: userIdToken },
callback: function (response) {
console.log("esta es la respuesta logros" +
response);
}
});
});
}); };
If I access from my own Google API testing page, from where the loi api is
approved, it doesn't work either
Thanks
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/d2a19414-5c29-471f-aeb9-fd14322a7a11%40googlegroups.com.