Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

🌱 Make response_type configurable #153

Merged
merged 3 commits into from
Mar 20, 2018
Merged

Conversation

jmelberg-okta
Copy link
Contributor

Description

Allows the OAuth 2.0 response_type to be configurable for implicit flows.

Important: code isn't explicitly supported yet.

Resolves: #109

@jmelberg-okta jmelberg-okta added this to the 1.0.0 - Angular & Vue milestone Mar 19, 2018
redirect_uri: '3',
response_type: 'a b'
})
expect(localVue.prototype.$auth).toBeDefined()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't expose the configuration or the AuthJS object in Vue, so there is no good way to check this feat.

Instead, we're ensuring the object still will be created.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using mocking you can still test the desired side effect: that oktaAuth.token.getWithRedirect is called with the right values, given the input options given to the Auth plugin constructor. Since there is already a mock of the internal authJs instance in this test file, you can use jest.fn() to add a mock version of token.getWithRedirect() to it and then use the mock.calls property to see that it was called with the expected response_type

const mockCallValues = mockAuthJsInstance.token.getWithRedirect.mock.calls[0][0]
expect(mockCallValues.responseType).toEqual(expect.arrayContaining(['token']))
expect(mockCallValues.scopes).toEqual(expect.arrayContaining(['foo', 'bar']))
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 awesome! I think we should also add another test that asserts that response_type will default to ['id_token', 'token'] if not overridden by config, because this is a library decision that we are explicitly making.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants