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

feat: add password grant utility and fix client id and grant type #602

Merged
merged 35 commits into from
Apr 24, 2020

Conversation

JoaoPedroAS51
Copy link
Collaborator

@JoaoPedroAS51 JoaoPedroAS51 commented Apr 9, 2020

This PR add password grant utility for providers initializePasswordGrantFlow. It uses refresh scheme.

Improve laravel passport provider to support password grant. To use it simple set grantType to password, your client id and client secret and pass username and password data to loginWith.

This also fix client id and grant type for local and refresh schemes

Usage example for laravel passport:

// Auth config
auth: {
  strategies: {
    'laravel.passport': {
       endpoints: {
         user: {
           url: '/api/auth/user'
         }
       },
       url: 'http://example.com',
       grantType: 'password',
       clientId: 'client-secret',
       clientSecret: 'client-secret'
    }
  }
}

// Login page
this.$auth.loginWith('laravel.passport', {
  data: {
    username: this.email,
    password: this.password
  }
})

This closes #600

@JoaoPedroAS51 JoaoPedroAS51 requested a review from pi0 April 9, 2020 03:56
@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

Merging #602 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev      #602   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            2         2           
=========================================
  Hits             2         2           
Impacted Files Coverage Δ
test/fixtures/basic/nuxt.config.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 269f237...269f237. Read the comment docs.

@JoaoPedroAS51 JoaoPedroAS51 changed the title feat(oauth2): add password grant support feat: add password grant support and fix client id and grant type Apr 22, 2020
@JoaoPedroAS51 JoaoPedroAS51 changed the title feat: add password grant support and fix client id and grant type feat: add password grant utility and fix client id and grant type Apr 22, 2020
# Conflicts:
#	examples/demo/nuxt.config.js
#	lib/schemes/refresh.js
@pi0 pi0 changed the base branch from dev to check April 24, 2020 12:04
@pi0 pi0 changed the base branch from check to dev April 24, 2020 12:04
@JoaoPedroAS51 JoaoPedroAS51 force-pushed the feat/oauth2-password-grant-support branch from e4e8413 to 269f237 Compare April 24, 2020 22:00
@pi0 pi0 merged commit f47885c into dev Apr 24, 2020
@pi0 pi0 deleted the feat/oauth2-password-grant-support branch April 24, 2020 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How To Work With Laravel Passport Grant type Password?
2 participants