@iad-os/react-ghost-auth
Advanced tools
Comparing version 0.1.18 to 0.1.19
@@ -9,2 +9,3 @@ import { AxiosStatic } from 'axios'; | ||
requested_scopes: string; | ||
access_type?: string; | ||
redirect_uri: string; | ||
@@ -11,0 +12,0 @@ redirect_logout_uri?: string; |
@@ -736,3 +736,4 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
const { axios, onTokenRequest, onRefreshTokenRequest } = _props; | ||
const { client_id, authorization_endpoint, requested_scopes, token_endpoint, end_session_endpoint, serviceUrl, redirect_uri, redirect_logout_uri, client_secret, } = _props.options; | ||
const { client_id, authorization_endpoint, requested_scopes, token_endpoint, end_session_endpoint, serviceUrl, redirect_uri, redirect_logout_uri, client_secret, access_type, } = _props.options; | ||
const BASIC_TOKEN = `Basic ${window.btoa(`${client_id}:${client_secret}`)}`; | ||
const [status, setStatus] = useState(!!getState() ? 'LOGGING' : 'INIT'); | ||
@@ -759,3 +760,3 @@ useEffect(() => { | ||
headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, (client_secret && { | ||
Authorization: `Basic ${window.btoa(`${client_id}:${client_secret}`)}"`, | ||
Authorization: BASIC_TOKEN, | ||
})), | ||
@@ -791,10 +792,6 @@ }) | ||
: () => axios | ||
.post(token_endpoint, queryString.stringify({ | ||
grant_type: 'refresh_token', | ||
refresh_token: getRefreshToken(), | ||
client_id, | ||
}), { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}, | ||
.post(token_endpoint, queryString.stringify(Object.assign({ grant_type: 'refresh_token', refresh_token: getRefreshToken() }, (!client_secret && { client_id }))), { | ||
headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, (client_secret && { | ||
Authorization: BASIC_TOKEN, | ||
})), | ||
}) | ||
@@ -826,2 +823,3 @@ .then(res => res.data); | ||
code_challenge_method: 'S256', | ||
access_type, | ||
}); | ||
@@ -855,12 +853,7 @@ }; | ||
function initFlowUrl(init) { | ||
const { authorization_endpoint, client_id, redirect_uri, requested_scopes, code_challenge, state, code_challenge_method, } = init; | ||
return `${authorization_endpoint}?${queryString.stringify({ | ||
response_type: 'code', | ||
client_id, | ||
state, | ||
scope: requested_scopes, | ||
redirect_uri, | ||
const { authorization_endpoint, client_id, redirect_uri, requested_scopes, code_challenge, state, code_challenge_method, access_type, } = init; | ||
return `${authorization_endpoint}?${queryString.stringify(Object.assign({ response_type: 'code', client_id, | ||
state, scope: requested_scopes, redirect_uri, | ||
code_challenge, | ||
code_challenge_method, | ||
})}`; | ||
code_challenge_method }, (access_type && { access_type })))}`; | ||
} | ||
@@ -867,0 +860,0 @@ function useAuthentication() { |
@@ -744,3 +744,4 @@ 'use strict'; | ||
const { axios, onTokenRequest, onRefreshTokenRequest } = _props; | ||
const { client_id, authorization_endpoint, requested_scopes, token_endpoint, end_session_endpoint, serviceUrl, redirect_uri, redirect_logout_uri, client_secret, } = _props.options; | ||
const { client_id, authorization_endpoint, requested_scopes, token_endpoint, end_session_endpoint, serviceUrl, redirect_uri, redirect_logout_uri, client_secret, access_type, } = _props.options; | ||
const BASIC_TOKEN = `Basic ${window.btoa(`${client_id}:${client_secret}`)}`; | ||
const [status, setStatus] = React.useState(!!getState() ? 'LOGGING' : 'INIT'); | ||
@@ -767,3 +768,3 @@ React.useEffect(() => { | ||
headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, (client_secret && { | ||
Authorization: `Basic ${window.btoa(`${client_id}:${client_secret}`)}"`, | ||
Authorization: BASIC_TOKEN, | ||
})), | ||
@@ -799,10 +800,6 @@ }) | ||
: () => axios | ||
.post(token_endpoint, queryString.stringify({ | ||
grant_type: 'refresh_token', | ||
refresh_token: getRefreshToken(), | ||
client_id, | ||
}), { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}, | ||
.post(token_endpoint, queryString.stringify(Object.assign({ grant_type: 'refresh_token', refresh_token: getRefreshToken() }, (!client_secret && { client_id }))), { | ||
headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, (client_secret && { | ||
Authorization: BASIC_TOKEN, | ||
})), | ||
}) | ||
@@ -834,2 +831,3 @@ .then(res => res.data); | ||
code_challenge_method: 'S256', | ||
access_type, | ||
}); | ||
@@ -863,12 +861,7 @@ }; | ||
function initFlowUrl(init) { | ||
const { authorization_endpoint, client_id, redirect_uri, requested_scopes, code_challenge, state, code_challenge_method, } = init; | ||
return `${authorization_endpoint}?${queryString.stringify({ | ||
response_type: 'code', | ||
client_id, | ||
state, | ||
scope: requested_scopes, | ||
redirect_uri, | ||
const { authorization_endpoint, client_id, redirect_uri, requested_scopes, code_challenge, state, code_challenge_method, access_type, } = init; | ||
return `${authorization_endpoint}?${queryString.stringify(Object.assign({ response_type: 'code', client_id, | ||
state, scope: requested_scopes, redirect_uri, | ||
code_challenge, | ||
code_challenge_method, | ||
})}`; | ||
code_challenge_method }, (access_type && { access_type })))}`; | ||
} | ||
@@ -875,0 +868,0 @@ function useAuthentication() { |
{ | ||
"name": "@iad-os/react-ghost-auth", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"maintainers": [ | ||
@@ -5,0 +5,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
155256
1670