mirror of
https://github.com/strapi/strapi.git
synced 2025-08-31 20:33:03 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
7d005ca12a
@ -125,7 +125,7 @@ module.exports = async (ctx, next) => {
|
||||
|
||||
The policy `isAdmin` located in `./api/restaurant/config/policies/isAdmin.js` will be executed before the `find` action in the `Restaurant.js` controller.
|
||||
|
||||
### Using a policy outside it's api
|
||||
### Using a policy outside its api
|
||||
|
||||
To use a policy in another api you can reference it with the following syntax: `{apiName}.{policyName}`.
|
||||
|
||||
|
@ -4,7 +4,7 @@ Strapi gives you the option to choose the most appropriate database for your pro
|
||||
**MariaDB**. The following documentation covers how to install these databases locally (for development purposes) and on various hosted or cloud server solutions (for staging or production purposes).
|
||||
|
||||
::: tip
|
||||
Deploying **Strapi** itself is covered in the [Deployment Guide](deployment.md).
|
||||
Deploying **Strapi** itself is covered in the [Deployment Guide](../getting-started/deployment.md).
|
||||
:::
|
||||
|
||||
## SQLite Installation
|
||||
|
@ -257,7 +257,7 @@ Then fill the informations:
|
||||
|
||||
- **Enable**: `ON`
|
||||
- **Client ID**: 226437944084-o2mojv5i4lfnng9q8kq3jkf5v03avemk.apps.googleusercontent.com
|
||||
- **Client ID**: aiTbMoiuJQflSBy6uQrfgsni
|
||||
- **Client Secret**: aiTbMoiuJQflSBy6uQrfgsni
|
||||
- **The redirect URL to your front-end app**: `http://localhost:3000/connect/google`
|
||||
|
||||
:::
|
||||
|
@ -22,7 +22,7 @@
|
||||
"graphql-type-json": "0.3.1",
|
||||
"graphql-type-long": "^0.1.1",
|
||||
"koa-compose": "^4.1.0",
|
||||
"lodash": "4.17.11",
|
||||
"lodash": "4.17.12",
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-utils": "3.0.0-beta.20.3"
|
||||
},
|
||||
|
@ -71,6 +71,8 @@ class PopUpForm extends React.Component {
|
||||
return `${strapi.backendURL}/connect/instagram/callback`;
|
||||
case 'vk':
|
||||
return `${strapi.backendURL}/connect/vk/callback`;
|
||||
case 'twitch':
|
||||
return `${strapi.backendURL}/connect/twitch/callback`;
|
||||
default: {
|
||||
const value = get(this.props.values, 'callback', '');
|
||||
|
||||
|
@ -86,6 +86,7 @@
|
||||
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
||||
"PopUpForm.Providers.instagram.providerConfig.redirectURL": "The redirect URL to add in your Instagram application configurations",
|
||||
"PopUpForm.Providers.vk.providerConfig.redirectURL": "The redirect URL to add in your VK application configurations",
|
||||
"PopUpForm.Providers.twitch.providerConfig.redirectURL": "The redirect URL to add in your Twitch application configurations",
|
||||
"PopUpForm.Providers.key.label": "Client ID",
|
||||
"PopUpForm.Providers.key.placeholder": "TEXT",
|
||||
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
||||
|
@ -84,6 +84,14 @@ module.exports = async () => {
|
||||
callback: `${strapi.config.server.url}/auth/vk/callback`,
|
||||
scope: ['email'],
|
||||
},
|
||||
twitch: {
|
||||
enabled: false,
|
||||
icon: 'twitch',
|
||||
key: '',
|
||||
secret: '',
|
||||
callback: `${strapi.config.server.url}/auth/twitch/callback`,
|
||||
scope: ['user:read:email'],
|
||||
},
|
||||
};
|
||||
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
|
||||
// store grant auth config to db
|
||||
|
@ -328,8 +328,7 @@ const getProfile = async (provider, query, callback) => {
|
||||
|
||||
vk.query()
|
||||
.get('users.get')
|
||||
.auth(access_token)
|
||||
.qs({ id: query.raw.user_id, v: '5.013' })
|
||||
.qs({ access_token, id: query.raw.user_id, v: '5.013' })
|
||||
.request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
@ -342,6 +341,50 @@ const getProfile = async (provider, query, callback) => {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'twitch': {
|
||||
const twitch = purest({
|
||||
provider: 'twitch',
|
||||
config: {
|
||||
twitch: {
|
||||
'https://api.twitch.tv': {
|
||||
__domain: {
|
||||
auth: {
|
||||
headers: {
|
||||
Authorization: 'Bearer [0]',
|
||||
'Client-ID': '[1]',
|
||||
},
|
||||
},
|
||||
},
|
||||
'helix/{endpoint}': {
|
||||
__path: {
|
||||
alias: '__default',
|
||||
},
|
||||
},
|
||||
'oauth2/{endpoint}': {
|
||||
__path: {
|
||||
alias: 'oauth',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
twitch
|
||||
.get('users')
|
||||
.auth(access_token, grant.twitch.key)
|
||||
.request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, {
|
||||
username: body.data[0].login,
|
||||
email: body.data[0].email,
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
callback({
|
||||
message: 'Unknown provider.',
|
||||
|
Loading…
x
Reference in New Issue
Block a user