Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-11-02 18:35:50 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
66173462608d6eea7e0e27a6843a95be3dcc20b0
66173462
1 parent
be78d3a8
fix refreshToken crash
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
6617346
...
...
@@ -932,6 +932,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
refreshToken
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
if
([
_db
tableExists
:
@"requestVariables"
]
==
YES
)
{
FMResultSet
*
refreshTokenSet
=
[
_db
executeQuery
:
@"SELECT refresh_token FROM requestVariables WHERE id = 1;"
];
NSString
*
refreshToken
=
[
NSString
alloc
];
while
([
refreshTokenSet
next
])
{
...
...
@@ -963,7 +964,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
NSString
*
errorCode
=
[
dict
objectForKey
:
@"NSLocalizedDescription"
];
if
([
errorCode
isEqual
:
@"Request failed: unauthorized (401)"
])
{
[
self
refreshToken2ndTry
:
^
(
NSDictionary
*
response
)
{
// [_db executeUpdate:@"UPDATE requestVariables SET access_token = ?, refresh_token = ? WHERE id = 1", [response objectForKey:@"access_token"], [response objectForKey:@"refresh_token"]];
// [_db executeUpdate:@"UPDATE requestVariables SET access_token = ?, refresh_token = ? WHERE id = 1", [response objectForKey:@"access_token"], [response objectForKey:@"refresh_token"]];
NSDictionary
*
successResponse
=
@{
@"result"
:
@"success"
,
@"status"
:
@1
};
success
(
successResponse
);
}
failureBlock
:
^
(
NSError
*
error
)
{
...
...
@@ -977,6 +978,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
NSLog
(
@"Error at token %@"
,
error
);
}
}];
}
}
-
(
void
)
refreshToken2ndTry
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
...
...
Please
register
or
login
to post a comment