FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
controlshift-oauth-example/example.rb at main · controlshift/controlshift-oauth-example · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Aug 7, 2026. It is now read-only.
controlshift
/
controlshift-oauth-example
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
controlshift-oauth-example
/
example.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
21 lines (15 loc) · 601 Bytes
Breadcrumbs
controlshift-oauth-example
/
example.rb
Copy path
File metadata and controls
executable file
·
21 lines (15 loc) · 601 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require
'bundler'
require
'bundler/setup'
require
'dotenv'
require
'json'
require
'oauth2'
Dotenv
.
load
client
=
OAuth2
::
Client
.
new
(
ENV
[
'CLIENT_ID'
]
,
ENV
[
'CLIENT_SECRET'
]
,
:site
=>
ENV
[
'SITE_URL'
]
)
authorization_url
=
client
.
auth_code
.
authorize_url
(
:redirect_uri
=>
ENV
[
'REDIRECT_URI'
]
)
puts
"Visit:
#{
authorization_url
}
to get a code"
puts
"Enter Code:"
code
=
gets
.
chomp
token
=
client
.
auth_code
.
get_token
(
code
,
:redirect_uri
=>
ENV
[
'REDIRECT_URI'
]
)
response
=
token
.
get
(
'/api/v1/organisation'
,
:headers
=>
{
'Accept'
=>
'application/json'
}
)
hash
=
JSON
.
parse
(
response
.
body
)
puts
hash
.
inspect
Back
|
FazBrowse Home
|
New Git URL