refactor: oauth process

This commit is contained in:
Rongjian Zhang 2020-01-27 13:24:01 +08:00
parent 65bebf63ea
commit e97befd412
2 changed files with 3 additions and 9 deletions

View File

@ -12,11 +12,12 @@ import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../utils/constants.dart';
import '../utils/utils.dart';
import 'account.dart';
import 'gitlab.dart';
const clientId = 'df930d7d2e219f26142a';
class PlatformType {
static const github = 'github';
static const gitlab = 'gitlab';
@ -64,14 +65,13 @@ class AuthModel with ChangeNotifier {
// Get token by code
final res = await http.post(
'https://github.com/login/oauth/access_token',
'https://git-touch-oauth.now.sh/api/token',
headers: {
HttpHeaders.acceptHeader: 'application/json',
HttpHeaders.contentTypeHeader: 'application/json',
},
body: json.encode({
'client_id': clientId,
'client_secret': clientSecret,
'code': uri.queryParameters['code'],
'state': _oauthState,
}),

View File

@ -1,6 +0,0 @@
// These keys are for development, not the production keys
// You can also create OAuth App at https://github.com/settings/applications/new
// to get your own keys and replace these ones
var clientId = '9b7d1cc04a1db5710767';
var clientSecret = '710e085908dde6a8b55f7a9dc447ad5c0c5617d1';