Open Closed

Getting Bearer Token for Postman (with 2FA flow) #7646


User avatar
0
zipper created
  • ABP Framework version: CLI 8.0.2
  • Tiered (for MVC) or Auth Server Separated (for Angular): Separated Auth Server
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

How do I setup postman to call the authentication flow to create a Bearer token that I can use as the auth header for other API calls? I need to:

  1. Login with credentials that are stored as environmental variables in Postman {{loginUsername}} and {{loginPassword}}.
  2. Process 2FA steps setup for that user (email, text message or authenticator) including prompting the Postman user for the validation code.
  3. Complete the authorization process and store the Bearer token value in variable for use in subsequent API calls.
  4. There should not be any redirect URL in any of these calls.

I am looking for the technique that would call the authorization for any pages in a collection, perhaps as a pre-request script? What are the endpoints? How do I process the options for 2FA flows? How do I generate and store the Bearer token?

These are the screenshots that might be relevant, but they are not screens I have used for configuration ... yet.


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can create an angular and enable the 2fa, then try to log in with the password flow. You will see the API requests in the browser console.

    angular/src/environments/environment.ts

    Change responseType to password.

    https://abp.io/docs/latest/framework/ui/angular/authorization?_redirected=B8ABF606AA1BDF5C629883DF1061649A#resource-owner-password-flow

    
    const oAuthConfig = {
      issuer: 'https://localhost:44305/',
      redirectUri: baseUrl,
      clientId: 'MyProjectName_App',
      responseType: 'password'
    
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38