Hexagon Geospatial
MENU

Smart M.App

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Frequent Contributor
Posts: 107
Registered: ‎10-16-2015
Accepted Solution

Getting Started with M.App Chest

I'd like to develop from my own IDE and now I'm trying to access M.App Chest from my local machine. I've created a ConsumerKey and ConsumerSecret for my app.

 

To test this I'm running this little code:

$.ajax({
    url: 'https://mapp.hexagongeospatial.com/uaa/oauth/authorize',
    data: {
        response_type: 'token',
        client_id: ConsumerKey,
        scope: 'All',
        redirect_uri: location.href.replace('development.html', 'redirected.html')
    },
}).fail( function( error ) {
    console.log( error );
    document.write( error.responseJSON.error_description );
})

 Right now this results in a 500 error 'No message available'

 

If I use the ConsumerKey of an app that's already been promoted and all something else happens:

 

first, this succeeds:

https://mapp.hexagongeospatial.com/uaa/oauth/authorize?response_type=token&client_id=<consumerKey>&s...>

 

This gets redirected to

https://mapp.hexagongeospatial.com/uaa/login/openid?openid_identifier=https://store.hexagongeospatia...

 

Then, finally to

https://store.hexagongeospatial.com/openid/op?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&o...

 

which fails, with this error: 

Redirect from ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

 

Indeed, the Origin header in the third request is set to null.

 

Basically my questions are:

  • is it possible to access the OAuth service from scripts outside the Studio? (I've done it before last year, but maybe things have changed?)
  • what is needed to make it work with an app that's still in development?

 

Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: Getting Started with M.App Chest

I found out.

 

Apparently the oauth/authorize url is not supposed to be called in an Ajax call, but the user needs to be redirected to that page.

 

And also: my app-in-development needs to be promoted. I've used the integration tests to assign the app to myself and now I have access.

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.