Microsoft Tech Community Live:  Microsoft Teams Edition
November 09, 2021, 08:00 AM - 12:00 PM (PST)

Why am i getting error when using an ajax call to retrieve my teams - using graph api

Occasional Contributor

I'm trying to get my teams(The teams i have joined) via an ajax call.

Sample below

function getmyTeams() {  
        method: 'GET',  
        //url: "",  
     url: "",        headers: {  
            'Authorization': 'Bearer ' + token,  
            'Content-Type': 'application/json'  
    }).success(function(response) {  

    }).error(function(error) {});  

This is my request token code which i believe i'm missing something.If i hardcode the token i get from graph explorer it works.Any ideas?


function requestToken() { 
"async": true, 
"crossDomain": true, 
"url": "", // Pass your tenant name  
"method": "POST", 
"headers": { 
"content-type": "application/x-www-form-urlencoded" 
"data": { 
"grant_type": "client_credentials", 
"client_id ": "from azure", //Provide your app id 
"client_secret": "from azure", //Provide your secret 
"scope ": "" 
success: function(response) { 
token = response.access_token;
//this works if i hardcode a token from graph. But i guess it could expire and how can i refresh it
//token="Token from Graph"; 
error: function(error) { 



But i'm getting error

GET 404 (Not Found)

I can also confirm i have setup postman and the above api url works fine and it returns the data i need

Also confirming the access token works with no issues as i can retrieve data when i use this api below

to get current users details I have also added this api permissions for graph 



I tried postman again but getting the error below

  "error": {
    "message""Failed to execute MsGraph backend request GetUserGroupsS2SRequest. Request Url:$/$filter=groupTypes/any(c...",
    "innerError": {


Any ideas what i'm missing? 

Thanks in Advance

5 Replies
Does anyone in here or from MS have any tip or answer for me?
Hi, How did you resolve it? Im stuck with these problem

@arty0m Sorry for the late reply.
I would have to look at it again and will let you know.
It has been a while i had a look at it

@naijacoder can you provide me the update on how did you manage to complete. I am able to get the refresh token from the postman and on basis of that i was able to generate new access token. how would i build the application that uses this