mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +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. | 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}`. | 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). | **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 | ::: 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 | ## SQLite Installation | ||||||
|  | |||||||
| @ -257,7 +257,7 @@ Then fill the informations: | |||||||
| 
 | 
 | ||||||
| - **Enable**: `ON` | - **Enable**: `ON` | ||||||
| - **Client ID**: 226437944084-o2mojv5i4lfnng9q8kq3jkf5v03avemk.apps.googleusercontent.com | - **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` | - **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-json": "0.3.1", | ||||||
|     "graphql-type-long": "^0.1.1", |     "graphql-type-long": "^0.1.1", | ||||||
|     "koa-compose": "^4.1.0", |     "koa-compose": "^4.1.0", | ||||||
|     "lodash": "4.17.11", |     "lodash": "4.17.12", | ||||||
|     "pluralize": "^7.0.0", |     "pluralize": "^7.0.0", | ||||||
|     "strapi-utils": "3.0.0-beta.20.3" |     "strapi-utils": "3.0.0-beta.20.3" | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -71,6 +71,8 @@ class PopUpForm extends React.Component { | |||||||
|         return `${strapi.backendURL}/connect/instagram/callback`; |         return `${strapi.backendURL}/connect/instagram/callback`; | ||||||
|       case 'vk': |       case 'vk': | ||||||
|         return `${strapi.backendURL}/connect/vk/callback`; |         return `${strapi.backendURL}/connect/vk/callback`; | ||||||
|  |       case 'twitch': | ||||||
|  |         return `${strapi.backendURL}/connect/twitch/callback`; | ||||||
|       default: { |       default: { | ||||||
|         const value = get(this.props.values, 'callback', ''); |         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.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.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.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.label": "Client ID", | ||||||
|   "PopUpForm.Providers.key.placeholder": "TEXT", |   "PopUpForm.Providers.key.placeholder": "TEXT", | ||||||
|   "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", | ||||||
|  | |||||||
| @ -84,6 +84,14 @@ module.exports = async () => { | |||||||
|       callback: `${strapi.config.server.url}/auth/vk/callback`, |       callback: `${strapi.config.server.url}/auth/vk/callback`, | ||||||
|       scope: ['email'], |       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' })) || {}; |   const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {}; | ||||||
|   // store grant auth config to db
 |   // store grant auth config to db
 | ||||||
|  | |||||||
| @ -328,8 +328,7 @@ const getProfile = async (provider, query, callback) => { | |||||||
| 
 | 
 | ||||||
|       vk.query() |       vk.query() | ||||||
|         .get('users.get') |         .get('users.get') | ||||||
|         .auth(access_token) |         .qs({ access_token, id: query.raw.user_id, v: '5.013' }) | ||||||
|         .qs({ id: query.raw.user_id, v: '5.013' }) |  | ||||||
|         .request((err, res, body) => { |         .request((err, res, body) => { | ||||||
|           if (err) { |           if (err) { | ||||||
|             callback(err); |             callback(err); | ||||||
| @ -342,6 +341,50 @@ const getProfile = async (provider, query, callback) => { | |||||||
|         }); |         }); | ||||||
|       break; |       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: |     default: | ||||||
|       callback({ |       callback({ | ||||||
|         message: 'Unknown provider.', |         message: 'Unknown provider.', | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Kevin Pfeifer
						Kevin Pfeifer