Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alp Deniz Ogut
photos_app
Commits
63e6e66f
Commit
63e6e66f
authored
2 years ago
by
Aziz Berkay Yesilyurt
Browse files
Options
Download
Email Patches
Plain Diff
refresh token if expired
parent
e88ab6d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/core/services/pod_service.dart
+5
-0
lib/core/services/pod_service.dart
lib/providers/app_provider.dart
+8
-1
lib/providers/app_provider.dart
with
13 additions
and
1 deletion
+13
-1
lib/core/services/pod_service.dart
+
5
-
0
View file @
63e6e66f
...
...
@@ -227,6 +227,11 @@ class PodService extends ApiService<PodAPI> {
return
resMap
[
'accessToken'
];
}
Future
<
String
?
>
oauth2GetAccessToken
({
required
String
platform
})
async
{
dynamic
resMap
=
await
api
.
oauth2GetAccessToken
(
platform
);
return
resMap
[
'accessToken'
];
}
Future
<
AuthUrl
>
oauth2url
(
{
required
String
redirectUrl
,
required
List
<
String
>
scopes
,
...
...
This diff is collapsed.
Click to expand it.
lib/providers/app_provider.dart
+
8
-
1
View file @
63e6e66f
...
...
@@ -640,7 +640,14 @@ class AppProvider with ChangeNotifier {
if
(
response
.
statusCode
==
200
)
{
return
true
;
}
else
{
// Token is invalid
// Token is invalid. maybe expiredfirst try to refresh
try
{
_podService
.
oauth2GetAccessToken
(
platform:
'twitter'
);
return
true
;
}
catch
(
e
)
{
AppLogger
.
err
(
'Error refreshing twitter access token
${e.toString()}
'
);
}
// Authenticate again
return
await
_podService
.
webAuth
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets