Skip to content

Commit

Permalink
feat: Properly implement prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Aug 7, 2022
1 parent c239dba commit 90c024a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion examples/simple_oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ client.login({
"messages.read",
"rpc",
"rpc.notifications.read"
]
],
prompt: "none" // Only prompt once
}); // These are the allowed scopes for unapproved app.
3 changes: 2 additions & 1 deletion examples/simple_oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ client.login({
"messages.read",
"rpc",
"rpc.notifications.read"
]
],
prompt: "none" // Only prompt once
}); // These are the allowed scopes for unapproved app.
6 changes: 3 additions & 3 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ export class Client extends (EventEmitter as new () => TypedEmitter<ClientEvents
await this.fetch("POST", "/oauth2/token/rpc", {
data: new URLSearchParams({
client_id: this.clientId,
client_secret: this.clientSecret ?? "",
prompt: options.prompt ?? "consent"
client_secret: this.clientSecret ?? ""
})
})
).data.rpc_token;
Expand All @@ -170,7 +169,8 @@ export class Client extends (EventEmitter as new () => TypedEmitter<ClientEvents
scopes: options.scopes,
client_id: this.clientId,
rpc_token: options.useRPCToken ? rpcToken : undefined,
redirect_uri: options.redirect_uri ?? undefined
redirect_uri: options.redirect_uri ?? undefined,
prompt: options.prompt ?? "consent"
})
).data;

Expand Down

0 comments on commit 90c024a

Please sign in to comment.