mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 16:14:01 +08:00
fix(plugin-auth): more fixes to plugin auth
This commit is contained in:
parent
e91c9b82f5
commit
ab527ab3a5
1 changed files with 7 additions and 5 deletions
|
@ -383,7 +383,9 @@ class NylasAPI
|
|||
# 3. The API request to auth this account to the plugin failed. This may mean that
|
||||
# the plugin server couldn't be reached or failed to respond properly when authing
|
||||
# the account, or that the Nylas API couldn't be reached.
|
||||
authPlugin: (pluginId, pluginName, account) ->
|
||||
authPlugin: (pluginId, pluginName, accountId) ->
|
||||
AccountStore = AccountStore || require './stores/account-store'
|
||||
account = AccountStore.accountForId(accountId)
|
||||
return @makeRequest({
|
||||
returnsModel: false,
|
||||
method: "GET",
|
||||
|
@ -393,12 +395,12 @@ class NylasAPI
|
|||
if result.authed
|
||||
return Promise.resolve()
|
||||
else
|
||||
return @_requestPluginAuth(pluginName, account).then( -> @makeRequest({
|
||||
return @_requestPluginAuth(pluginName, account).then( => @makeRequest({
|
||||
returnsModel: false,
|
||||
method: "POST",
|
||||
accountId: account.id,
|
||||
path: "/auth/plugin",
|
||||
body: JSON.stringify({client_id: pluginId}),
|
||||
body: {client_id: pluginId},
|
||||
json: true
|
||||
}))
|
||||
)
|
||||
|
@ -422,11 +424,11 @@ You can review and revoke Offline Access for plugins at any time from Preference
|
|||
)
|
||||
)
|
||||
|
||||
unauthPlugin: (pluginId, account) ->
|
||||
unauthPlugin: (pluginId, accountId) ->
|
||||
return @makeRequest({
|
||||
returnsModel: false,
|
||||
method: "DELETE",
|
||||
accountId: account.id,
|
||||
accountId: accountId,
|
||||
path: "/auth/plugin?client_id=#{pluginId}"
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue