Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
78665074
Commit
78665074
authored
Jan 09, 2017
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/example-app: add option to not request a refresh token
parent
0f4a1f69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
main.go
cmd/example-app/main.go
+4
-1
templates.go
cmd/example-app/templates.go
+3
-0
No files found.
cmd/example-app/main.go
View file @
78665074
...
...
@@ -241,12 +241,15 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) {
authCodeURL
:=
""
scopes
=
append
(
scopes
,
"openid"
,
"profile"
,
"email"
)
if
a
.
offlineAsScope
{
if
r
.
FormValue
(
"offline_acecss"
)
!=
"yes"
{
authCodeURL
=
a
.
oauth2Config
(
scopes
)
.
AuthCodeURL
(
exampleAppState
)
}
else
if
a
.
offlineAsScope
{
scopes
=
append
(
scopes
,
"offline_access"
)
authCodeURL
=
a
.
oauth2Config
(
scopes
)
.
AuthCodeURL
(
exampleAppState
)
}
else
{
authCodeURL
=
a
.
oauth2Config
(
scopes
)
.
AuthCodeURL
(
exampleAppState
,
oauth2
.
AccessTypeOffline
)
}
http
.
Redirect
(
w
,
r
,
authCodeURL
,
http
.
StatusSeeOther
)
}
...
...
cmd/example-app/templates.go
View file @
78665074
...
...
@@ -14,6 +14,9 @@ var indexTmpl = template.Must(template.New("index.html").Parse(`<html>
</p>
<p>
Extra scopes:<input type="text" name="extra_scopes" placeholder="list of scopes">
</p>
<p>
Request offline access:<input type="checkbox" name="offline_access" value="yes" checked>
</p>
<input type="submit" value="Login">
</form>
...
...
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