{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • BaaS/Usergrid /
avatar image
0
Question by Sreenivas Sadhu Prabhakara · Oct 30, 2017 at 01:12 AM · 148 Views baasauthenticationusergridpassword-grant

unable to login into apigee baas via userGrid and express, although same works from postman

hi There,

Am unable to get authenticated via usergrid for doing a get on usergrid.

am trying to follow the same things as mentioned in :

http://apigee.com/docs/app-services/content/authenticating-users-and-application-clients

and as in the dev boot camp.

The same set of credentials work alright when am making the request via POSTMan.

please let me know if you need any more details around the same.

Thank you,

Regards,

Sreenivas S P

sample code is attached below

var express = require('express'); var usergrid = require('usergrid'); var config = require('./config'); // Set up Express environment and enable it to read and write JavaScript var app = express(); app.use(express.bodyParser()); // Initialize Usergrid var client = new usergrid.client({ orgName : config.organization, appName : config.application, authType : usergrid.authenticateUser, username : config.userId, password : config.UserPassword, authMode : usergrid.AUTH_MODE_NONE, grant_type : 'password', URI : 'https://apigee-edu-prod.apigee.net/appservices' , logging : config.logging }); client.login( grant_type, username, password, function(error){ if (error){ console.log( " could not login the user : "+ username); } else { var token = client.token; console.log("user " + username +" is logged in"); } }) app.get('/wishlists', function(req, res) { var options = { type: 'wishlist' } //getWishlists(req, res); client.createCollection( options, function (err, data) { if (err) { // could not make a collection res.send(JSON.stringify({error:'myError'})); } else { // Success - New Collection Worked var wishlist; var wishlists = []; while(data.hasNextEntity()){ wishlist = data.getNextEntity(); console.log(JSON.stringify(wishlist)); wishlists.push({ display_name: wishlist.get('display_name'), uuid: wishlist.get('uuid'), products : wishlist.get('products'), userId: wishlist.get('userId') }); res.send(JSON.stringify(wishlists)); } } }); }) var port = process.env.PORT || 9000; app.listen(port, function(){ console.log('The server is listening on port %d', port); });

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

2 Answers

  • Sort: 
avatar image
0
Best Answer

Answer by Sreenivas Sadhu Prabhakara · Nov 01, 2017 at 04:59 PM

hi There,

looks like the connection is happening.

and we need to include authType : usergrid.AUTH_APP_USER even though the grant type is password.

and thus the connection is getting established.

Thank you for trying.

Regards,

Sreenivas S P

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Raunak Narooka   · Oct 30, 2017 at 10:14 AM

@Sreenivas Sadhu Prabhakara Can you try using a different authmode? I believe AUTH_MODE_NONE might not work. Can you try

AUTH_APP_USER

Also if you have turned on logging, you probably might see what url Usergrid is connecting too? Can you just check the transaction logs while debugging?

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

49 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Date fields inside BaaS entity 1 Answer

Failed to dequeue | Error getting from queue index after 5 tries 0 Answers

Issues while authenticating Application and Application User 2 Answers

Bulk insert in APIGEE BAAS from (CSV file in AWS S3) using node 1 Answer

How do I query BaaS/Usergrid using Paw for MacOS X? 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Articles
  • Ideas
  • Badges