Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
oauth-play
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ASM
oauth-play
Commits
c56692f7
Commit
c56692f7
authored
Sep 04, 2017
by
Andreas Åkre Solberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add save serverconfig.
parent
a3d5b009
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
5 deletions
+44
-5
package-lock.json
package-lock.json
+5
-0
src/components/ServerConfigInput.jsx
src/components/ServerConfigInput.jsx
+5
-3
src/index.js
src/index.js
+2
-0
src/reducers/index.js
src/reducers/index.js
+6
-0
src/utils/API.js
src/utils/API.js
+26
-2
No files found.
package-lock.json
View file @
c56692f7
...
...
@@ -6167,6 +6167,11 @@
"reduce-reducers"
:
"0.1.2"
}
},
"redux-localstorage"
:
{
"version"
:
"0.4.1"
,
"resolved"
:
"https://registry.npmjs.org/redux-localstorage/-/redux-localstorage-0.4.1.tgz"
,
"integrity"
:
"sha1-+vbXGcWBOXKU2BFHP/zt7gZckzw="
},
"redux-promise"
:
{
"version"
:
"0.5.3"
,
"resolved"
:
"https://registry.npmjs.org/redux-promise/-/redux-promise-0.5.3.tgz"
,
...
...
src/components/ServerConfigInput.jsx
View file @
c56692f7
...
...
@@ -12,13 +12,15 @@ class Component extends PureComponent {
console
.
log
(
"
--- props
"
,
this
.
props
)
this
.
state
=
{
clientId
:
"
6233aedf-f08a-4112-9a1b-f33c3cd9b396
"
,
clientSecret
:
"
af85a0f0-2c68-421d-8228-a6c83628de19
"
clientSecret
:
"
af85a0f0-2c68-421d-8228-a6c83628de19
"
,
redirectURL
:
"
http://localhost:8080/callback
"
}
}
authenticateStart
()
{
console
.
error
(
"
Authenticate
"
)
let
config
=
Object
.
assign
({},
this
.
props
.
serverConfig
,
this
.
state
)
console
.
error
(
"
Authenticate
"
,
config
)
this
.
props
.
authenticateStart
(
config
)
}
...
...
@@ -76,7 +78,7 @@ class Component extends PureComponent {
<
h4
>
Redirect URI
</
h4
>
<
p
>
When you configure your client, please register the following redirect uri:
</
p
>
<
p
><
code
>
http://localhost:8080/callback
</
code
></
p
>
<
p
><
code
>
{
this
.
state
.
redirectURL
}
</
code
></
p
>
<
div
>
<
Button
onClick
=
{
this
.
authenticateStart
.
bind
(
this
)
}
bsStyle
=
"primary"
>
...
...
src/index.js
View file @
c56692f7
...
...
@@ -37,6 +37,8 @@ let store = createStore(
)
)
store
.
dispatch
(
API
.
callback
())
// const state = store.getState()
// if (!state.auth.user.token) {
// const token = appJso.checkToken()
...
...
src/reducers/index.js
View file @
c56692f7
...
...
@@ -17,6 +17,12 @@ const reducer = handleActions({
serverConfig
:
action
.
payload
}
}
},
serverConfig
:
{
save
:
(
config
)
=>
({
serverConfig
:
config
.
serverConfig
,
serverError
:
null
})
}
},
{
...
...
src/utils/API.js
View file @
c56692f7
import
actions
from
'
../actions/
'
import
jso
from
'
../../lib/jso
'
// console.error("actions", actions)
let
appJSO
=
null
const
API
=
{
...
...
@@ -36,10 +37,33 @@ const API = {
"
authenticate
"
:
function
(
config
)
{
return
dispatch
=>
{
console
.
error
(
"
About to save config
"
,
config
)
console
.
error
(
"
About to save config
"
,
JSON
.
stringify
(
config
,
undefined
,
3
)
)
dispatch
(
actions
.
serverConfig
.
save
(
config
))
console
.
error
(
"
About to authentication
"
)
const
jsoconfig
=
{
providerID
:
"
oauthPlay
"
,
client_id
:
config
.
clientId
,
redirect_uri
:
config
.
redirectURL
,
authorization
:
config
.
authorization_endpoint
// scopes: { request: ["userinfo"]}
}
setTimeout
(()
=>
{
console
.
error
(
"
JSOCONFIG
"
,
JSON
.
stringify
(
jsoconfig
,
undefined
,
2
))
appJSO
=
new
jso
(
jsoconfig
)
appJSO
.
getToken
((
token
)
=>
{
console
.
error
(
"
Got token, ayay
"
,
token
)
})
},
1000
)
}
},
"
callback
"
:
function
()
{
return
(
dispatch
,
getState
)
=>
{
var
state
=
getState
()
console
.
error
(
"
Callback
"
,
state
)
// appJSO.callback()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment