Authorization has been denied for this request

Hello to everyone , I’m newbie with graphiql .I have some problems, I want to consult with you on this.

1- Sambapos Messaging 9000+ OK no problem.
2- i tried Access too http://localhost:9000 OK . i saw grapql query screen and docs working fine.
3- I wanted to implement the Todo List example, but when I looked at the consol section, I saw the following error :

Things I tried : Firewall OFF completely.
Messaging Server changing port.

I’ve been looking for a forum on this topic, but I can not find an answer, maybe because of my inadequacy, I apologize for it. thank you

Have you set user etc in the code to match a system user?
That seems tone a responce so it’s not a firewall etc issue as you wouldn’t get a responce if it wasn’t working. It’s working but you not providing or providing wrong auth values.

1 Like

Yes I actually logged in with “sambapos” and “password” , It seems to work when I come back after logging in. That message disappears in localhost: 9000 but when I enter / app / test3, I get this error again in console.

For now login with a random user name and password as password on http://localhost:9000/login page.

You can find more info here.
https://forum.sambapos.com/t/sambapos-5-1-61-beta/11464/172

These are not released features and may change on final release.

3 Likes

Here is a quick detail on how to Login …

GQL requires authorization as of .61.

You generally only need to do this once. Go to:

http://localhost:9000

Now edit the address bar to the following and hit enter:

http://localhost:9000/login

You should be prompted for username and password which for now it is “sambapos” and “password”, respectively (the Password is the important part and is currently hard-coded to: password). So enter that info and click Go.

Nothing will appear to happen.

Click the BACK button on your Browser, which will take you back to:

http://localhost:9000

Now the Auth Message should be gone and you can do stuff.


Clipped from this Topic:

1 Like

I’ve already done this, localhost: 9000 does not seem to be a problem, but in sambapos ; I saw this message in the todo list example.

Error here :

The ToDo example was written before GQL Auth existed (v5.1.60). You need to add Authorization function into the sample code to make it work with .61:

gqlAuthorize = function (user, password, callback) {
    var aurl = 'http://' + GQLhost + ':' + GQLport + '/Token';
    user = (user ? user : 'samba');
    password = (password ? password : 'password');
    
        jQuery.ajax({
        'type': 'POST',
        'url': aurl,
        cache:false,
        headers: {'Content-Type':'application/x-www-form-urlencoded'},
        data: $.param({grant_type:'password', username:user, password:password})
        })
        .done(function d(response){
            accessToken = response.access_token;
            console.log('AUTHORIZED GQL: ' + accessToken.substr(0,20) + ' ...');
            if (callback) {
                callback(accessToken);
            }
        });
};

Call it like this:

$(document).ready(function(){

  gqlAuthorize('','',function gqlAuth(authResp){
    // authResp should contain the Access Token which you can check/verify and either continue or not
    if (authResp) {
      // auth succeeded, continue your code
    } else {
      // auth failed, show a message
    }
  });

});

Hi Emre,

can you open access to this page. error" Sorry, you don’t have access to that topic!"

thanks
andy

Looks like it is in the beta testing category.

That is old information.
Read here

1 Like