From e133c998ac218ddf2f3dd738b962cf95c5cd6025 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Sat, 24 Aug 2019 22:08:30 +0800 Subject: [PATCH] feat: redirect to oauth with js --- src/components/SettingsBar.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/SettingsBar.tsx b/src/components/SettingsBar.tsx index 6349a8b..cc7af13 100644 --- a/src/components/SettingsBar.tsx +++ b/src/components/SettingsBar.tsx @@ -232,9 +232,14 @@ export default class SettingsBar extends React.PureComponent { {!hasAccessToken && ( { + // use js here to make sure redirect_uri is latest url + const url = `https://github.com/login/oauth/authorize?client_id=${ + oauth.clientId + }&scope=repo&redirect_uri=${encodeURIComponent(window.location.href)}` + window.location.href = url + }} > Create with OAuth