From c94ec5f3fe731151c9390de9c087cb6f88e05f76 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 13 Mar 2021 08:05:59 +0800 Subject: [PATCH] Updated angel_auth_oauth2 --- packages/auth_oauth2/example/main.dart | 9 +++++---- packages/auth_oauth2/pubspec.yaml | 27 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/auth_oauth2/example/main.dart b/packages/auth_oauth2/example/main.dart index 123cd0e4..983da4e6 100644 --- a/packages/auth_oauth2/example/main.dart +++ b/packages/auth_oauth2/example/main.dart @@ -20,17 +20,18 @@ var options = ExternalAuthOptions( /// Github doesn't properly follow the OAuth2 spec, so here's logic to parse their response. Map parseParamsFromGithub(MediaType contentType, String body) { if (contentType.type == 'application') { - if (contentType.subtype == 'x-www-form-urlencoded') + if (contentType.subtype == 'x-www-form-urlencoded') { return Uri.splitQueryString(body); - else if (contentType.subtype == 'json') + } else if (contentType.subtype == 'json') { return (json.decode(body) as Map).cast(); + } } throw FormatException( 'Invalid content-type $contentType; expected application/x-www-form-urlencoded or application/json.'); } -main() async { +void main() async { // Create the server instance. var app = Angel(); var http = AngelHttp(app); @@ -60,7 +61,7 @@ main() async { // This function is called when the user ACCEPTS the request to sign in with Github. (client, req, res) async { - var response = await client.get('https://api.github.com/user'); + var response = await client.get(Uri.parse('https://api.github.com/user')); var ghUser = json.decode(response.body); var id = ghUser['id'] as int; diff --git a/packages/auth_oauth2/pubspec.yaml b/packages/auth_oauth2/pubspec.yaml index 151b07a1..fe84396d 100644 --- a/packages/auth_oauth2/pubspec.yaml +++ b/packages/auth_oauth2/pubspec.yaml @@ -1,17 +1,24 @@ name: angel_auth_oauth2 description: angel_auth strategy for OAuth2 login, i.e. Facebook, Github, etc. -version: 2.1.0 -author: Tobe O +version: 3.0.0 +#author: Tobe O +publish_to: none environment: - sdk: ">=2.10.0 <2.12.0" + sdk: ">=2.10.0 <3.0.0" homepage: https://github.com/angel-dart/auth_oauth2.git dependencies: - angel_auth: # ^2.0.0 - path: ../auth - angel_framework: # ^2.0.0-alpha - path: ../framework - http_parser: ^3.0.0 - oauth2: ^1.0.0 + angel_auth: + git: + url: https://github.com/dukefirehawk/angel.git + ref: sdk-2.12.x + path: packages/auth + angel_framework: + git: + url: https://github.com/dukefirehawk/angel.git + ref: sdk-2.12.x + path: packages/framework + http_parser: ^4.0.0 + oauth2: ^2.0.0 dev_dependencies: - logging: ^0.11.0 + logging: ^1.0.0 pedantic: ^1.0.0 \ No newline at end of file