Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix revoke request parameter #141

Merged
merged 8 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const clientSecret = appleSignin.getClientSecret({
const options = {
clientID: 'com.company.app', // Apple Client ID
clientSecret,
tokenHintType: 'refresh_token'
tokenTypeHint: 'refresh_token'
};

try {
Expand All @@ -176,7 +176,7 @@ const clientSecret = appleSignin.getClientSecret({
const options = {
clientID: 'com.company.app', // Apple Client ID
clientSecret,
tokenHintType: 'access_token'
tokenTypeHint: 'access_token'
};

try {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('test for each functions', () => {
const option = {
clientID: 'clientID',
clientSecret: 'clientSecret',
tokenHintType: 'refresh_token',
tokenTypeHint: 'refresh_token',
};
it('Should not throw error when response is empty', async () => {
const result = await appleSignin.revokeAuthorizationToken(token, option);
Expand All @@ -55,7 +55,7 @@ describe('test for each functions', () => {
const option = {
clientID: 'clientID',
clientSecret: 'clientSecret',
tokenHintType: 'refresh_token',
tokenTypeHint: 'refresh_token',
};
it('Should not throw error when response is empty', async () => {
const result = await appleSignin.getAuthorizationToken(code, option);
Expand All @@ -70,7 +70,7 @@ describe('test for each functions', () => {
const option = {
clientID: 'clientID',
clientSecret: 'clientSecret',
tokenHintType: 'refresh_token',
tokenTypeHint: 'refresh_token',
};
it('Should not throw error when response is empty', async () => {
const result = await appleSignin.refreshAuthorizationToken(
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const revokeAuthorizationToken = async (
options: {
clientID: string,
clientSecret: string,
tokenHintType: 'refresh_token' | 'access_token',
tokenTypeHint: 'refresh_token' | 'access_token',
},
): Promise<any> => {
if (!options.clientID) {
Expand All @@ -289,7 +289,7 @@ const revokeAuthorizationToken = async (
params.append('client_id', options.clientID);
params.append('client_secret', options.clientSecret);
params.append('token', token);
params.append('token_hint_type', options.tokenHintType);
params.append('token_type_hint', options.tokenTypeHint);

const result = await fetch(url.toString(), {
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion typescript/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ declare function revokeAuthorizationToken(
options: {
clientID: string;
clientSecret: string;
tokenHintType: 'refresh_token' | 'access_token';
tokenTypeHint: 'refresh_token' | 'access_token';
},
): Promise<any>;

Expand Down
6 changes: 3 additions & 3 deletions typescript/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ async function test() {
refreshAuthorizationToken('');

// $ExpectType Promise<any>
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenHintType: 'refresh_token' });
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenTypeHint: 'refresh_token' });

// $ExpectType Promise<any>
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenHintType: 'access_token' });
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenTypeHint: 'access_token' });

// $ExpectError
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenHintType: '' });
revokeAuthorizationToken('', { clientID: '', clientSecret: '', tokenTypeHint: '' });

// $ExpectError
revokeAuthorizationToken('', { clientID: '', clientSecret: '' });
Expand Down