mirror of
https://github.com/git-touch/git-touch
synced 2025-02-02 17:07:06 +01:00
parent
c1b3d330e0
commit
31c43eebc8
@ -728,9 +728,11 @@ class AuthModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
String _oauthState;
|
||||
void redirectToGithubOauth() {
|
||||
void redirectToGithubOauth([publicOnly = false]) {
|
||||
_oauthState = nanoid();
|
||||
var scope = Uri.encodeComponent('user,repo,read:org,notifications');
|
||||
final repoScope = publicOnly ? 'public_repo' : 'repo';
|
||||
final scope = Uri.encodeComponent(
|
||||
['user', repoScope, 'read:org', 'notifications'].join(','));
|
||||
launchUrl(
|
||||
'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=$scope&state=$_oauthState',
|
||||
);
|
||||
|
@ -157,6 +157,12 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
auth.redirectToGithubOauth();
|
||||
},
|
||||
),
|
||||
ActionItem(
|
||||
text: 'via OAuth (Public repos only)',
|
||||
onTap: (_) {
|
||||
auth.redirectToGithubOauth(true);
|
||||
},
|
||||
),
|
||||
ActionItem(
|
||||
text: 'via Personal token',
|
||||
onTap: (_) async {
|
||||
|
Loading…
x
Reference in New Issue
Block a user