Merge branch 'client-fix-openid-method' into 'master'

[Client] Fix openid method

See merge request famedly/famedlysdk!161
This commit is contained in:
Christian Pauly 2020-01-13 11:56:22 +00:00
commit 3eced168a6
2 changed files with 8 additions and 8 deletions

View file

@ -1056,7 +1056,7 @@ class Client {
/// The generated token is only valid for exchanging for user information from the federation API for OpenID. /// The generated token is only valid for exchanging for user information from the federation API for OpenID.
Future<OpenIdCredentials> requestOpenIdCredentials() async { Future<OpenIdCredentials> requestOpenIdCredentials() async {
final Map<String, dynamic> response = await jsonRequest( final Map<String, dynamic> response = await jsonRequest(
type: HTTPType.GET, type: HTTPType.POST,
action: "/client/r0/user/$userID/openid/request_token"); action: "/client/r0/user/$userID/openid/request_token");
return OpenIdCredentials.fromJson(response); return OpenIdCredentials.fromJson(response);
} }

View file

@ -522,13 +522,6 @@ class FakeMatrixApi extends MockClient {
static final Map<String, Map<String, dynamic>> api = { static final Map<String, Map<String, dynamic>> api = {
"GET": { "GET": {
"/client/r0/user/@test:fakeServer.notExisting/openid/request_token":
(var req) => {
"access_token": "SomeT0kenHere",
"token_type": "Bearer",
"matrix_server_name": "example.com",
"expires_in": 3600
},
"/client/r0/rooms/1/state/m.room.member/@alice:example.com": (var req) => "/client/r0/rooms/1/state/m.room.member/@alice:example.com": (var req) =>
{"displayname": "Alice"}, {"displayname": "Alice"},
"/client/r0/profile/@getme:example.com": (var req) => { "/client/r0/profile/@getme:example.com": (var req) => {
@ -761,6 +754,13 @@ class FakeMatrixApi extends MockClient {
(var req) => syncResponse, (var req) => syncResponse,
}, },
"POST": { "POST": {
"/client/r0/user/@test:fakeServer.notExisting/openid/request_token":
(var req) => {
"access_token": "SomeT0kenHere",
"token_type": "Bearer",
"matrix_server_name": "example.com",
"expires_in": 3600
},
"/client/r0/login": (var req) => { "/client/r0/login": (var req) => {
"user_id": "@test:fakeServer.notExisting", "user_id": "@test:fakeServer.notExisting",
"access_token": "abc123", "access_token": "abc123",