Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 041e9bb

Browse files
committed
Merge pull request #29 from ethul/topic/credentials
Topic/credentials
2 parents 0c26fd8 + 9bca684 commit 041e9bb

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

iOS/SimpleAuthWrapper.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ @implementation SimpleAuthWrapper
2121
if (responseObject) {
2222
NSDictionary *credentials = [responseObject objectForKey: @"credentials"];
2323
NSString *token = [credentials objectForKey: @"token"];
24+
NSString *secret = [credentials objectForKey: @"secret"];
25+
26+
NSDictionary *result;
27+
if (secret == nil) {
28+
result = @{@"token": token};
29+
}
30+
else {
31+
result = @{@"token": token, @"secret": secret};
32+
}
2433

2534
NSDictionary *extra;
2635
if ([responseObject objectForKey:@"extra"]) {
@@ -29,7 +38,7 @@ @implementation SimpleAuthWrapper
2938
extra = responseObject;
3039
}
3140

32-
callback(@[[NSNull null], token, [extra objectForKey: @"raw_info"]]);
41+
callback(@[[NSNull null], result, [extra objectForKey: @"raw_info"]]);
3342
} else {
3443
if (error) {
3544
NSMutableDictionary *dict=[NSMutableDictionary dictionaryWithCapacity:1];

lib/simpleauthclient.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ class SimpleAuthClient {
9999
*/
100100
authorize(provider) {
101101
return new Promise((resolve, reject) => {
102-
SimpleAuthWrapper.authorize(provider, function(error, token, info) {
102+
SimpleAuthWrapper.authorize(provider, function(error, credentials, info) {
103103
if (error) {
104104
reject(error);
105105
} else {
106-
info.token = token;
106+
info.token = credentials.token;
107+
info.credentials = credentials;
107108
resolve(info)
108109
}
109110
});
@@ -112,4 +113,4 @@ class SimpleAuthClient {
112113

113114
}
114115

115-
module.exports = new SimpleAuthClient();
116+
module.exports = new SimpleAuthClient();

0 commit comments

Comments
 (0)