Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(BaseConfig): encode redirect url for all providers
Browse files Browse the repository at this point in the history
LinkedIn denies access when redirect uri is not encoded

Fix#113
  • Loading branch information
0xSalman committed Apr 23, 2016
1 parent e1e8fea commit adc9082
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/baseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class BaseConfig {
name: 'google',
url: '/auth/google',
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
scope: ['profile', 'email'],
scopePrefix: 'openid',
scopeDelimiter: ' ',
Expand All @@ -149,7 +149,7 @@ export class BaseConfig {
name: 'facebook',
url: '/auth/facebook',
authorizationEndpoint: 'https://www.facebook.com/v2.3/dialog/oauth',
redirectUri: window.location.origin + '/' || window.location.protocol + '//' + window.location.host + '/',
redirectUri: encodeURI(window.location.origin + '/' || window.location.protocol + '//' + window.location.host + '/'),
scope: ['email'],
scopeDelimiter: ',',
nonce: function() {
Expand All @@ -167,7 +167,7 @@ export class BaseConfig {
name: 'linkedin',
url: '/auth/linkedin',
authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
requiredUrlParams: ['state'],
scope: ['r_emailaddress'],
scopeDelimiter: ' ',
Expand All @@ -182,7 +182,7 @@ export class BaseConfig {
name: 'github',
url: '/auth/github',
authorizationEndpoint: 'https://github.com/login/oauth/authorize',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
optionalUrlParams: ['scope'],
scope: ['user:email'],
scopeDelimiter: ' ',
Expand All @@ -196,7 +196,7 @@ export class BaseConfig {
name: 'yahoo',
url: '/auth/yahoo',
authorizationEndpoint: 'https://api.login.yahoo.com/oauth2/request_auth',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
scope: [],
scopeDelimiter: ',',
type: '2.0',
Expand All @@ -219,7 +219,7 @@ export class BaseConfig {
name: 'live',
url: '/auth/live',
authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
scope: ['wl.emails'],
scopeDelimiter: ' ',
requiredUrlParams: ['display', 'scope'],
Expand All @@ -234,7 +234,7 @@ export class BaseConfig {
name: 'instagram',
url: '/auth/instagram',
authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
redirectUri: encodeURI(window.location.origin || window.location.protocol + '//' + window.location.host),
requiredUrlParams: ['scope'],
scope: ['basic'],
scopeDelimiter: '+',
Expand Down

0 comments on commit adc9082

Please sign in to comment.