| ... | ... | @@ -277,10 +277,10 @@ pub fn Handlers(comptime T: type) type { |
| 277 | 277 | if (req.status != .ok) return error.OauthBadToken; |
| 278 | 278 | const val = try extras.parse_json(alloc, body_content); |
| 279 | 279 | |
| 280 | | const tt = val.root.object.get("token_type").?.string; |
| 280 | const tt = val.value.object.get("token_type").?.string; |
| 281 | 281 | if (!std.mem.eql(u8, tt, "bearer")) return fail(response, body_writer, "oauth2: invalid token type: {s}", .{tt}); |
| 282 | 282 | |
| 283 | | const at = val.root.object.get("access_token") orelse return try fail(response, body_writer, "Identity Provider Login Error!\n{s}", .{body_content}); |
| 283 | const at = val.value.object.get("access_token") orelse return try fail(response, body_writer, "Identity Provider Login Error!\n{s}", .{body_content}); |
| 284 | 284 | |
| 285 | 285 | const req2 = try zfetch.Request.init(alloc, client.provider.me_url, null); |
| 286 | 286 | var headers2 = zfetch.Headers.init(alloc); |
| ... | ... | @@ -294,9 +294,9 @@ pub fn Handlers(comptime T: type) type { |
| 294 | 294 | if (req2.status != .ok) return error.OauthBadUserinfo; |
| 295 | 295 | const val2 = try extras.parse_json(alloc, body_content2); |
| 296 | 296 | |
| 297 | | const id = try fixId(alloc, val2.root.object.get(client.provider.id_prop).?); |
| 298 | | const name = val2.root.object.get(client.provider.name_prop).?.string; |
| 299 | | try T.saveInfo(response, alloc, client.provider, id, name, val.root, val2.root); |
| 297 | const id = try fixId(alloc, val2.value.object.get(client.provider.id_prop).?); |
| 298 | const name = val2.value.object.get(client.provider.name_prop).?.string; |
| 299 | try T.saveInfo(response, alloc, client.provider, id, name, val.value, val2.value); |
| 300 | 300 | |
| 301 | 301 | try response.headers.append("Location", T.doneUrl); |
| 302 | 302 | response.status = .found; |