screen size not supported

Docs

You can use examples below to check how DummyJSON works.

Auth

Login user and get token

You can use any user's credentials from dummyjson.com/users

              
fetch('https://dummyjson.com/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    
    username: 'kminchelle',
    password: '0lelplR',
    expiresInMins: 30, // optional, defaults to 60
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Get current auth user

              
/* providing token in bearer */
fetch('https://dummyjson.com/auth/me', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer /* YOUR_TOKEN_HERE */', 
  }, 
})
.then(res => res.json())
.then(console.log);
            
           
Show output

Refresh auth session

Extend the session and create a new token without username and password

              
fetch('https://dummyjson.com/auth/refresh', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer /* YOUR_TOKEN_HERE */', 
  },
  body: JSON.stringify({
    expiresInMins: 30, // optional, defaults to 60
  })
})
.then(res => res.json())
.then(console.log);
            
           
Show output
Intro Products