Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function MsTeamsActivityContainer({ match, history }) {
const params = new URLSearchParams();
params.append('client_id', config.teamsClientId);
params.append('response_type', 'code');
params.append('scope', 'offline_access user.read mail.read');
params.append('scope', 'offline_access user.read');
params.append('redirect_uri', `https://${window.location.hostname}/msteams/callback`);
params.append('state', window.location.href);
url.search = params.toString();
Expand Down
3 changes: 2 additions & 1 deletion src/containers/MsTeams/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ const MsTeamsCallBack = () => {
const params = new URLSearchParams(useLocation().search);
const code = params.get('code');
const state = params.get('state');
const tenantId = state.split('msteam/')[1].split('/launch')[0];
const [error, setError] = useState(null);

// Get app context and auth token
useEffect(() => {
MsTeamsService.msTeamsToken(code)
MsTeamsService.msTeamsToken(code, tenantId)
.then((response) => {
localStorage.setItem('msteams_token', response.access_token);
localStorage.setItem('msteams_refresh_token', response.refresh_token);
Expand Down
3 changes: 2 additions & 1 deletion src/services/msTeams.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import config from 'config';
import httpService from './http.service';
const { apiVersion } = config;

const msTeamsToken = (code) => httpService
const msTeamsToken = (code, tenantId) => httpService
.get(`/microsoft-team/get-access-token-via-code`,
{},
{
code: code,
tenantId: tenantId,
})
.then(({ data }) => data)
.catch((err) => Promise.reject(err.response.data));
Expand Down