mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 09:47:46 +00:00
Merge pull request #1613 from synth3tk/auth-microsoft
Add Microsoft Graph auth provider
This commit is contained in:
commit
eada18a619
@ -51,6 +51,8 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
|
|||||||
return `${strapi.backendURL}/connect/google/callback`;
|
return `${strapi.backendURL}/connect/google/callback`;
|
||||||
case 'github':
|
case 'github':
|
||||||
return get(this.props.values, 'redirect_uri', '');
|
return get(this.props.values, 'redirect_uri', '');
|
||||||
|
case 'microsoft':
|
||||||
|
return `${strapi.backendURL}/connect/microsoft/callback`;
|
||||||
default: {
|
default: {
|
||||||
const value = get(this.props.values, 'callback', '');
|
const value = get(this.props.values, 'callback', '');
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@
|
|||||||
"PopUpForm.Providers.facebook.providerConfig.redirectURL": "The redirect URL to add in your Facebook application configurations",
|
"PopUpForm.Providers.facebook.providerConfig.redirectURL": "The redirect URL to add in your Facebook application configurations",
|
||||||
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
||||||
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
|
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
|
||||||
|
"PopUpForm.Providers.microsoft.providerConfig.redirectURL": "The redirect URL to add in your Microsoft application configurations",
|
||||||
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
||||||
"PopUpForm.Providers.twitter.providerConfig.redirectURL": "The redirect URL to add in your Twitter application configurations",
|
"PopUpForm.Providers.twitter.providerConfig.redirectURL": "The redirect URL to add in your Twitter application configurations",
|
||||||
|
|
||||||
|
@ -77,6 +77,14 @@ module.exports = async cb => {
|
|||||||
'user:email'
|
'user:email'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
microsoft: {
|
||||||
|
enabled: false,
|
||||||
|
icon: 'windows',
|
||||||
|
key: '',
|
||||||
|
secret: '',
|
||||||
|
callback: '/auth/microsoft/callback',
|
||||||
|
scope: ['user.read']
|
||||||
|
},
|
||||||
twitter: {
|
twitter: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
icon: 'twitter',
|
icon: 'twitter',
|
||||||
|
@ -208,6 +208,40 @@ const getProfile = async (provider, query, callback) => {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'microsoft': {
|
||||||
|
const microsoft = new Purest({
|
||||||
|
provider: 'microsoft',
|
||||||
|
config:{
|
||||||
|
'microsoft': {
|
||||||
|
'https://graph.microsoft.com': {
|
||||||
|
'__domain': {
|
||||||
|
'auth': {
|
||||||
|
'auth': {'bearer': '[0]'}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'[version]/{endpoint}': {
|
||||||
|
'__path': {
|
||||||
|
'alias': '__default',
|
||||||
|
'version': 'v1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
microsoft.query().get('me').auth(access_token).request((err, res, body) => {
|
||||||
|
if (err) {
|
||||||
|
callback(err);
|
||||||
|
} else {
|
||||||
|
callback(null, {
|
||||||
|
username: body.userPrincipalName,
|
||||||
|
email: body.userPrincipalName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'twitter': {
|
case 'twitter': {
|
||||||
const twitter = new Purest({
|
const twitter = new Purest({
|
||||||
provider: 'twitter',
|
provider: 'twitter',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user