Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 445554a

Browse files
committed
Testing re-enabling oauth
1 parent 914ea9e commit 445554a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

application.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
application = Flask(__name__)
1212
app = application
13-
app.secret_key = os.environ.get('APP_SECRET_KEY')
14-
# app.permanent_session_lifetime = timedelta(days=1)
13+
#app.secret_key = os.environ.get('APP_SECRET_KEY')
14+
app.secret_key = os.urandom(32)
15+
#app.permanent_session_lifetime = timedelta(days=1)
1516

1617
stwrapper = StockTwitsWrapper()
1718
stwrapper.compile_regex_patterns()
@@ -58,11 +59,11 @@ def auth_redirect_uri():
5859
return redirect(request.url_root) # go back home after successful auth
5960

6061

61-
# Not using any ST endpoints that require auth yet
62+
# Not actually using any ST endpoints that require auth yet
6263
@app.before_request
6364
def check_session():
64-
# session.permanent = True
65-
# need to comment out this block AND push to prod to develop oauth locally
65+
#session.permanent = True
66+
# need to comment out this block and push to prod to use oauth on localhost
6667
if '/auth_redirect_uri/' != request.path:
6768
if 'user_id' not in session or 'access_token' not in session:
6869
auth_code_url = authwrapper.get_auth_code_url(request.url_root)

auth_wrapper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AuthWrapper:
1010
client_id = '7cc80ecf361d0f13'
1111
auth_redirect_postfix = 'auth_redirect_uri/'
1212
# uncomment along with other 2 lines for local oauth testing
13-
# bs_auth_redirect_url = 'https://stocktwitsanalyzer-env.us-west-2.elasticbeanstalk.com/'
13+
#bs_auth_redirect_url = 'https://stocktwitsanalyzer-env.us-west-2.elasticbeanstalk.com/'
1414

1515
@classmethod
1616
def get_auth_code_url(self, auth_redirect_root):
@@ -19,7 +19,7 @@ def get_auth_code_url(self, auth_redirect_root):
1919
auth_code_params = dict(
2020
response_type='code',
2121
redirect_uri=auth_redirect_root + self.auth_redirect_postfix,
22-
# redirect_uri = self.bs_auth_redirect_url + self.auth_redirect_postfix,
22+
#redirect_uri=self.bs_auth_redirect_url + self.auth_redirect_postfix,
2323
client_id=self.client_id,
2424
scope='read'
2525
)
@@ -35,7 +35,7 @@ def get_auth_token(self, auth_code, auth_redirect_root):
3535
auth_token_params = dict(
3636
code=auth_code,
3737
redirect_uri=auth_redirect_root,
38-
# redirect_uri = self.bs_auth_redirect_url + self.auth_redirect_postfix,
38+
#redirect_uri=self.bs_auth_redirect_url + self.auth_redirect_postfix,
3939
client_id=self.client_id,
4040
client_secret=os.environ.get('ST_API_KEY'),
4141
grant_type='authorization_code'

0 commit comments

Comments
 (0)